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.
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.
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