Skip to content

Instantly share code, notes, and snippets.

@athulmurali
Created July 31, 2018 10:07
Show Gist options
  • Save athulmurali/ced8928220cec063105d78596958428b to your computer and use it in GitHub Desktop.
Save athulmurali/ced8928220cec063105d78596958428b to your computer and use it in GitHub Desktop.
express-code-angular
//Install express server
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}/front-end/dist/`));
app.get('/*', function(req,res) {
res.sendFile(`./front-end/dist/index.html`);
// load the single view file (angular will handle the page changes on the front-end)
});
console.log("listening.... ")
app.listen(process.env.PORT || 8080);
// Start the app by listening on the default Heroku port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment