Last active
July 15, 2018 07:59
-
-
Save florimondmanca/3544aa14526dd1b6abd92ff85a6b7568 to your computer and use it in GitHub Desktop.
Lightweight Angular production server
This file contains 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
/* | |
npm install --save express morgan | |
*/ | |
const express = require('express'); | |
const morgan = require('morgan'); | |
const app = express(); | |
app.use(express.static(__dirname + '/dist')); | |
app.use(morgan('combined')) | |
app.get('*', function(req, res) { | |
res.sendFile(__dirname + '/dist/index.html'); | |
}); | |
const port = process.env.PORT || 4200; | |
app.listen(port); | |
console.log(`Server listening on port ${port}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment