DEV Community

Discussion on: How to deploy a Node/Express App to Vercel

Collapse
 
andrewbaisden profile image
Andrew Baisden

Using serverless functions could be a solution vercel.com/docs/serverless-functio...

However you can get it working with normal html files.

1 - Create a folder in the root directory called views and put an index.html file inside of it.

2 - Add the code below to your index.js file

const path = require('path');

app.get('/', (req, res) => {
    res.sendFile(path.join(__dirname + '/views/index.html'));
});
Enter fullscreen mode Exit fullscreen mode

Now you can use html pages for your routes.