git clone --depth 1 https://github.com/vyakymenko/angular2-seed-express.git
cd angular2-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 build.docs# 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
# or development
$ node app.server.dev.js
# run server in daemon mode
$ pm2 start app.server.prod.js
Need to know
Before starting development. Run you development server:
# run dev server
$ node app.server.dev.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
# run Express server in dev mode
$ node app.server.dev.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 Angular2 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 Angular2 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;
}
}
Here are all the awesome guys who are helping to make the project's wiki even better!
37 Minko Gechev
22 Clayton K. N. Passos
15 Shyam-Chen
14 Vincent van Proosdij
8 Christian Dobert
8 Robert van Kints
8 matthew harwood
6 Ludovic HENIN
5 Attila Egyed
3 Stefan Schüller
3 Patrick Hillert
3 Ezequiel Cicala
2 Nathan Walker
2 Yannick Koehler
2 Giovanni Candido da Silva
2 Simon Hampton
2 Cy Klassen
2 Joshua Wiens
2 Drake Wilson
2 Dinsitro
1 zcsongor
1 BouncingBit
1 Brian Kotek
1 Chris Kapilla
1 Dang Tung
1 Eddie Sun
1 Enrico Secondulfo
1 Eugene Serkin
1 Ishara Samantha
1 Myrmex
1 Pol Stafford
1 Raphael Schmitt
1 Sebastian Fuss
1 Sebastien de Salvador
1 The Ult
1 graham
1 kiuka
1 Ankit Kamboj