Skip to content

Instantly share code, notes, and snippets.

@superjojo140
Last active February 10, 2020 14:57
Show Gist options
  • Save superjojo140/6977a42d0c2cb7a48f47f083144bfd04 to your computer and use it in GitHub Desktop.
Save superjojo140/6977a42d0c2cb7a48f47f083144bfd04 to your computer and use it in GitHub Desktop.
Serve compiled angular files
const express = require('express');
const app = express();
// Serve the static files from the angular build
app.use(express.static(`${__dirname}/dist/PROJECT_NAME`));
app.get('/*',(req,res) => {
res.sendFile(`${__dirname}/dist/PROJECT_NAME/index.html`);
});
// Start the app
app.listen(process.env.PORT || 8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment