Skip to content

Instantly share code, notes, and snippets.

@davideast
Last active August 10, 2017 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davideast/9b646ce78c325a19247786e292f919b3 to your computer and use it in GitHub Desktop.
Save davideast/9b646ce78c325a19247786e292f919b3 to your computer and use it in GitHub Desktop.
Angular Universal Server
import { angularUniversal } from 'angular-universal-express';
import * as express from 'express';
const app = express();
// serving static requests
app.use(express.static(__dirname + '/static'));
// serving dynamic requests
app.get('/*', angularUniversal({
index: __dirname + '/index.html',
main: __dirname + '/main.<your-hash>.bundle',
enableProdMode: true
}));
app.listen(3005, () => { console.log('Listening on 3005'); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment