Skip to content

Instantly share code, notes, and snippets.

@blanks88
Created July 29, 2019 23:49
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 blanks88/f773676e26ca04c7474d7de1ed982220 to your computer and use it in GitHub Desktop.
Save blanks88/f773676e26ca04c7474d7de1ed982220 to your computer and use it in GitHub Desktop.
const express = require('express');
const path = require('path');
const app = express();
// Run the app by serving the static files
// in the dist directory
app.use(express.static(__dirname + '/dist'));
// Start the app by listening on the default
// Heroku port
app.listen(process.env.PORT || 8080);
// For all GET requests, send back index.html
// so that PathLocationStrategy can be used
app.get('/*', function(req, res) {
res.sendFile(path.join(__dirname + '/dist/index.html'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment