You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
git clone --depth 1 https://github.com/vyakymenko/angular-seed-express.git
cd angular-seed-express
# install the project dependencies
$ npm install
# watches your files and uses livereload by default
$ npm start
# api document for the app# $ npm run compodoc# dev build
$ npm run build.dev
# prod build
$ npm run build.prod
# run Redis
$ src/redis-server
# stop Redis
$ src/redis-cli
$ shutdown SAVE
# run Express server (keep in touch, only after `npm run build.prod` )
$ node app.server.prod.js
# run server in daemon mode
$ pm2 start app.server.prod.js
Express Server
Express server run for prod build.
# run Express server (keep in touch, only after `npm run build.prod` )# keep in mind that prod build will be builded with prod env flag
$ node app.server.prod.js
Daemonize Server
For daemonize your server I propose to uze PM2.
# before daemonize production server `npm run build.prod`
$ pm2 start app.server.prod.js
# restart only your project
$ pm restart <id># restart all project on daemon
$ pm2 restart all
# in cluster mode ( example 4 workers )
$ pm2 start app.server.prod.js -i 4
// Configure server Port ( keep in mind that this important if you will use reverse-proxy)// Dev mode will give you only middleware.// WARNING! DEPEND ON YOUR Angular SEED PROJECT API CONFIG!/** * @ng2 Server Runner `Development`. */require('./server')(9001,'dev');
app.server.prod.js
// Configure server Port ( keep in mind that this important if you will use reverse-proxy)// Prod mode give you middleware + static.// WARNING! DEPEND ON YOUR Angular SEED PROJECT API CONFIG!/** * @ng2 Server Runner `Production`. */require('./server')(9000);
Reverse Proxy NginX Config Example
server {
listen 80;
# App Web Adress Listener
server_name www.example.com example.com;
location / {
# Port where we have our daemon `pm2 start app.server.js`
proxy_pass http://example.com:9000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}