angular universal(angular or angular-cli) can be create three part:
browser folder
ng build --prod
to generated static fileserver folder
A server bundle by script(bundle)
server.js
webpack bundle serve (bundle)
Run node dist/server.js
can be work on localhost:4000.
But when I have a node.js(express) server, how can I deploy these files?
If I only have one file by ng build --prod
, I can deploy it on node.js like this.
app.js:
app.get('/*', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'dist/index.html'));
});