Want to feel like a full-stack Angular developer but know only Express?
This is an express seed project for Angular apps based on Minko Gechev's angular-seed. Include:
- Full include from Minko Gechev's angular-seed.
- Express Express Node.js server for production/development build API.
- PM2 daemon for a server running.
- Nginx configuration file for your server.
For Angular development information and wiki, look here:
- Angular-Seed
- Angular-Seed-WIKI Wiki Information about Seed!
- Angular-Seed-Advanced It's a Nathan's Walker child seed for multi-platform Angular apps.
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 build.docs
# dev build
$ npm run build.dev
# prod build
$ npm run build.prod
# prod build using different base path
$ npm run build.prod -- --base "/foo/bar/"
# 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.jsExpress 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.jsFor 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 4More details about PM2
##
# Your Angular.io NginX .conf
##
http {
log_format gzip '[$time_local] ' '"$request" $status $bytes_sent';
access_log /dev/stdout;
charset utf-8;
default_type application/octet-stream;
types {
text/html html;
text/javascript js;
text/css css;
image/png png;
image/jpg jpg;
image/svg+xml svg svgz;
application/octet-steam eot;
application/octet-steam ttf;
application/octet-steam woff;
}
server {
listen 3353;
server_name local.example.com;
root app/;
add_header "X-UA-Compatible" "IE=Edge,chrome=1";
location ~ ^/(scripts|styles)/(.*)$ {
root .tmp/;
error_page 404 =200 @asset_pass;
try_files $uri =404;
break;
}
location @asset_pass {
root app/;
try_files $uri =404;
}
location / {
expires -1;
add_header Pragma "no-cache";
add_header Cache-Control "no-store, no-cache, must-revalicate, post-check=0 pre-check=0";
root app/;
try_files $uri $uri/ /index.html =404;
break;
}
}
server {
listen 3354;
sendfile on;
##
# Gzip Settings
##
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 1100;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;
root dist/;
location ~ ^/(assets|bower_components|scripts|styles|views) {
expires 31d;
add_header Cache-Control public;
}
##
# Main file index.html
##
location / {
try_files $uri $uri/ /index.html =404;
}
}
}
You can look in source file here.
app.server.dev.js
// 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);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;
}
}
- About Redis.
- Download and install latest stable version of Redis.
- Documentation about Redis.
After installation we need to start our server:
# start server
$ src/redis-server- Redis Persistence
- Redis More Properties
- In progress
- In progress
| mgechev | ludohenin | d3viant0ne | Shyam-Chen | NathanWalker | Nightapes |
| tarlepp | karlhaas | TheDonDope | robstoll | nareshbhatia | hank-ehly |
| kiuka | fr-esco | vyakymenko | jesperronn | daniru | patrickmichalina |
| nhutcorp | aboeglin | netstart | eppsilon | sasikumardr | nulldev07 |
| gkalpak | markwhitfeld | Karasuni | sfabriece | ryzy | jerryorta-dev |
| treyrich | natarajanmca11 | e-oz | nosachamos | pgrzeszczak | alllx |
| LuxDie | JakePartusch | JayKan | JohnCashmore | larsthorup | admosity |
| Doehl | irsick | StefanKoenen | amedinavalencia | odk211 | troyanskiy |
| tsm91 | domfarolino | juristr | jvitor83 | ouq77 | ahmadqarshi |
| turbohappy | gotenxds | devanp92 | DmitriyPotapov | fisenkodv | evanplaice |
| JunaidZA | c-ice | markharding | ojacquemart | rafaelss95 | rajeev-tripathi |
| ArnaudPel | TuiKiken | vogloblinsky | edud69 | idready | zbarbuto |
| Yonet | Green-Cat | ip512 | joshboley | Marcelh1983 | pbazurin-softheme |
| Bigous | salemdar | alexweber | allenhwkim | hellofornow | yassirh |
| amaltsev | tomlobato | taguan | bbarry | bbogdanov | sonicparke |
| brendanbenson | brian428 | briantopping | ckapilla | cadriel | Cselt |
| dszymczuk | dmurat | peah90 | dstockhammer | madcalfus | dwido |
| totev | JimbeanZN | emilio-simoes | ericdoerheit | gp187 | gsamokovarov |
| koodikindral | hkashlan | hpinsley | NN77 | isidroamv | JohnnyQQQQ |
| jeffbcross | Drane | johnjelinek | JunusErgin | justindujardin | karlhiramoto |
| lihaibh | Brooooooklyn | tandu | inkidotcom | mpetkov | daixtrose |
| MathijsHoogland | maxklenk | mjwwit | oferze | ocombe | gdi2290 |
| typekpb | pavlovich | philipooo | redian | robbatt | robertpenner |
| Sjiep | RoxKilly | siovene | SamVerschueren | sclausen | heavymery |
| na-oma | tapas4java | tsvetomir | valera-rozuvan | vincentpalita | VladimirMakaev |
| Yalrafih | arioth | billsworld | blackheart01 | butterfieldcons | danielcrisp |
| gforceg | jgolla | locinus | omerfarukyilmaz | ZuSe | rossedfort |
| ruffiem | savcha | tobiaseisenschenk | ultrasonicsoft | Falinor |
You can follow the Angular change log here.
MIT