javascript - Any way to restart a nodejs application hosted on vercel? - Stack Overflow

I've a nodejsexpress application hosted on vercel. The way I've set it up is that when the s

I've a nodejs/express application hosted on vercel. The way I've set it up is that when the server starts it connects to the database (mongo atlas) and checks if there's a user by the username of admin or not if it's not there then it will create one.

I had to delete my data from the database. And now I need to restart the nodejs server so that it can automatically create the user. Which is required to login to the application.

any idea how to restart the server. So that it can reconnect to the mongodb and after that it creates the required user.

I've redeply the app multiple times but that doesn't seem to restart it as no new user was created. This is my vercel.json file

{
   "version": 2,
   "name": "mf-backend",
   "builds": [
      { "src": "server.js", "use": "@vercel/node" }
   ],
   "routes": [
      { "src": "/(.*)", "dest": "/server.js" }
   ]
}

I've a nodejs/express application hosted on vercel. The way I've set it up is that when the server starts it connects to the database (mongo atlas) and checks if there's a user by the username of admin or not if it's not there then it will create one.

I had to delete my data from the database. And now I need to restart the nodejs server so that it can automatically create the user. Which is required to login to the application.

any idea how to restart the server. So that it can reconnect to the mongodb and after that it creates the required user.

I've redeply the app multiple times but that doesn't seem to restart it as no new user was created. This is my vercel.json file

{
   "version": 2,
   "name": "mf-backend",
   "builds": [
      { "src": "server.js", "use": "@vercel/node" }
   ],
   "routes": [
      { "src": "/(.*)", "dest": "/server.js" }
   ]
}
Share Improve this question asked Oct 30, 2022 at 14:28 Zullu BaltiZullu Balti 731 silver badge7 bronze badges 3
  • Do you want to restart the app only ? If that is it, you can restart the app on vercel dashboard. You go to deployement section then you will see all deployements. You can redeploy it after you clicked the settings icon on the deploy item. – Halil Commented Oct 30, 2022 at 20:13
  • Yes, I only want to restart the server (node/express). And redeploying it isn't restarting the server. – Zullu Balti Commented Oct 31, 2022 at 4:39
  • also any way to check the logs like we can do in heroku? – Zullu Balti Commented Oct 31, 2022 at 5:06
Add a ment  | 

1 Answer 1

Reset to default 5
  1. Go to vercel page.

  2. Click the project you created.

  3. Click the deployments section on the left-top menu.

  4. There will be deployments. If you want to re-deploy your last deploy, click the settings icon then select redeploy selection on the dropdown menu.

  5. Then the project will be redeployed according to your last deployment.

If you want to examine the deployment logs, you can examine logs on "View Build Logs" and "View Function Logs". They are on the project's main page.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745433075a4627481.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信