Skip to content

Instantly share code, notes, and snippets.

@florimondmanca
Last active July 15, 2018 07:59
Show Gist options
  • Save florimondmanca/3544aa14526dd1b6abd92ff85a6b7568 to your computer and use it in GitHub Desktop.
Save florimondmanca/3544aa14526dd1b6abd92ff85a6b7568 to your computer and use it in GitHub Desktop.
Lightweight Angular production server
/*
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