Home > Enterprise >  Any way to restart a nodejs application hosted on vercel?
Any way to restart a nodejs application hosted on vercel?

Time:11-02

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" }
   ]
}

CodePudding user response:

  1. Go to enter image description here

  2. There will be deployements. If you want to re-deploy your last deploy, you should click the settings icon then select redeploy selection on dropdown menu. enter image description here

  3. Then the project will be redeployede according your last deploy.

If you show the logs of the deployement, you can show logs on "View Build Logs" and "View Function Logs". They are project main page.

  • Related