How to deploy a Node/Express App to Vercel

This is just a quick simple example of course more complex applications will work as well.

Prerequisites

Step 1

Create an account with Vercel if you don’t already have one.

Vercel is a cloud platform for static sites and Serverless Functions that fits perfectly with your workflow. It enables developers to host Jamstack websites and web services that deploy instantly, scale automatically, and requires no supervision, all with no configuration.

Step 2

Use npm to install Vercel globally on your computer https://www.npmjs.com/package/vercel

Setup the project

Create a project

Open the project in your code editor and then create a Node server in the index.js file

Create a run script in the package.json file

Run the command below to see your Node app working locally in the browser

Deploying to Vercel

Make sure that you are in the root folder for your project and then run the command vercel in your terminal.

Use the project setup settings below as a guide to setup your own project with Vercel.

Once that is complete it is going to give you some links. The app is NOT going to work yet it is only going to show you the code inside of your index.js file. You need to create a vercel.json file and put it in the root folder so that Vercel knows that it is a Node application. And it is very important that your index.js file remains in the root folder along with your other server side code for the project otherwise your app won't work.

Create a vercel.json file and put it in the root of your project folder and then add the code below

Now run the command vercel again to deploy your app. Open the Production link and your app should be working online with full working routes.

👨🏿‍💻 Full Stack Developer 📝 Blogger 🎮 Gamer ✏️ Creative 👁 Anime Addict ٩(●ᴗ●)۶

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store