Deploy a node server to Vercel!

ยท

1 min read

Deploy a node server to Vercel!

Vercel ๐Ÿ˜

Vercel, the creator of Next js. But isn't that where you are supposed to host your frontend applications.

Yes, but not just that!

We can host node backend applications on Vercel. Vercel essentially allows running a serverless instance of your app.

Deploying to Vercel

Create a free account on Vercel. (Preferably, use a provider where the repository for code is hosted)

Add a vercel.json file in the root folder.

{
  "version": 2,
  "name": "name-of-your-vercel-app",
  "builds": [
    { "src": "script.js", "use": "@vercel/node" }
  ],
  "routes": [
    { "src": "/(.*)", "dest": "/index.js" }
  ]
}

Now create a new project on Vercel.

image.png When setting up the repository, we need to select the Other option in Frameworks to deploy a backend server. You can also configure Environment variables at this stage.

image.png And that's it you have deployed your server blazing fast ๐Ÿš€.

If you are a developer enjoying Vercel to deploy your front-end applications, you will definitely love Vercel for hosting your backend node applications.

What's your go-to way for deploying a node server? ๐Ÿ™Œ๐Ÿป

Source repo: mongo-CRUD-basics

Deployed app: https://mongoose-crud.vercel.app/

Feel free to reach out to me on Twitter and connect with me on LinkedIn

If you loved the article and would like to support me

ย