- Add vercel.json configuration After exporting Express, we have to tell Vercel what files to build, how to build them, and how to route them using a vercel.json file. So create a vercel.json file.
touch vercel.json
Then using Vercel Platform version 2, specify your index.js file and the NPM module Vercel will use to turn it into a serverless function...
{
"version": 2,
"builds": [
{
"src": "dist/server.js",
"use": "@vercel/node"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "dist/server.js"
}
]
}
npm install -g vercel
npm run build
vercel --prod
Top comments (0)