最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论