[Vuejs]-Running a prod server using express and a webpack config on heroku

0👍

Looks like the code in server.js was not referring to my prod build. When I changed the code to point to the correct directory and redeployed to heroku, my app showed up

const express = require('express');
const path = require('path');

const port = process.env.PORT || 8080;
const app = express();

// the __dirname is the current directory from where the script is running
app.use(express.static(__dirname + "/www"));

// send the user to index html page inspite of the url
app.get('*', (req, res) => {
  res.sendFile(path.resolve(__dirname, 'index.html'));
});

app.listen(port);

Leave a comment