Skip to content

Instantly share code, notes, and snippets.

@tieppt
Created August 20, 2019 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tieppt/6406f4884130593f8fa8583684f2db6d to your computer and use it in GitHub Desktop.
Save tieppt/6406f4884130593f8fa8583684f2db6d to your computer and use it in GitHub Desktop.
const express = require('express');
const path = require('path');
const app = express();
// Serve only the static files form the dist directory
app.use(express.static(__dirname + '/dist/<name-of-app>'));
app.get('/*', (req, res) => {
res.sendFile(path.join(__dirname + '/dist/<name-of-app>/index.html'));
});
// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || 8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment