Last active
February 10, 2020 14:57
-
-
Save superjojo140/6977a42d0c2cb7a48f47f083144bfd04 to your computer and use it in GitHub Desktop.
Serve compiled angular files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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