Angular
ng build --prod --aot
app.js in express
var express = require('express'); var path = require('path'); var cookieParser = require('cookie-parser'); var logger = require('morgan'); var compression = require('compression'); var app = express(); app.use(logger('dev')); app.use(express.json()); app.use(express.urlencoded({extended: false})); app.use(cookieParser()); app.use(compression()); app.use(express.static(path.join(__dirname, 'public'), {maxAge: 31536000})); app.get('*', function (req, res, next) { var file = path.join(__dirname, 'public', 'index.html'); res.sendFile(file); }); module.exports = app;