create local server to run angular app code example
Example 1: ng serve local network
CLI command
ng serve --host 0.0.0.0
Or add to package.json
"scripts": {
"local-start": "ng serve --host 0.0.0.0"
}
Example 2: host angular app on node server
const express = require('express');
const http = require('http');
const path = require('path');
const app = express();
const port = process.env.PORT || 3001;
app.use(express.static(__dirname + '/dist/my-app-name'));
app.get('/*', (req, res) => res.sendFile(path.join(__dirname)));
const server = http.createServer(app);
server.listen(port, () => console.log(`App running on: http://localhost:${port}`));