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 a node backend applications on Vercel. Vercel essentially allows running a server on Vercel.
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 projecton 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
Top comments (1)
What did you use for front end? How does that work with Vercel?