Skip to content

Latest commit

 

History

History
377 lines (284 loc) · 37.7 KB

README.old.md

File metadata and controls

377 lines (284 loc) · 37.7 KB

Introduction

Greenkeeper badge

Angular Style Guide MIT license Build status Build Status Dependency Status devDependency Status

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:

Fast start

For Angular development information and wiki, look here:

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

More details about PM2

How to configure my NginX

##
# 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.

Express Configuration

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 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;
    }
}

Redis Download/Install

Redis Start

After installation we need to start our server:

# start server
$ src/redis-server

Redis More Settings + Daemonize

MongoDB

  • In progress

MySQL

  • In progress

Contributors

mgechev ludohenin greenkeeper[bot] d3viant0ne Shyam-Chen vyakymenko
mgechev ludohenin greenkeeper[bot] d3viant0ne Shyam-Chen vyakymenko
tarlepp Nightapes karlhaas robstoll TheDonDope NathanWalker
tarlepp Nightapes karlhaas robstoll TheDonDope NathanWalker
hankehly nareshbhatia kiuka fr-esco salemdar jesperronn
hankehly nareshbhatia kiuka fr-esco salemdar jesperronn
daniru patrickmichalina ArnaudPel nhutcorp netstart nulldev07
daniru patrickmichalina ArnaudPel nhutcorp netstart nulldev07
eppsilon sasikumardr aboeglin gkalpak markwhitfeld Karasuni
eppsilon sasikumardr aboeglin gkalpak markwhitfeld Karasuni
sfabriece ryzy jerryorta-dev treyrich natarajanmca11 e-oz
sfabriece ryzy jerryorta-dev treyrich natarajanmca11 e-oz
troyanskiy nosachamos pgrzeszczak alllx ArminZol LuxDie
troyanskiy nosachamos pgrzeszczak alllx ArminZol LuxDie
JakePartusch admosity JohnCashmore larsthorup ouq77 Doehl
JakePartusch admosity JohnCashmore larsthorup ouq77 Doehl
irsick StefanKoenen amedinavalencia odk211 tsm91 domfarolino
irsick StefanKoenen amedinavalencia odk211 tsm91 domfarolino
juristr jvitor83 JayKan ahmadqarshi gotenxds devanp92
juristr jvitor83 JayKan ahmadqarshi gotenxds devanp92
DmitriyPotapov fisenkodv emilio-simoes evanplaice JunaidZA c-ice
DmitriyPotapov fisenkodv emilio-simoes evanplaice JunaidZA c-ice
markharding maxmarkus ojacquemart rafaelss95 turbohappy TuiKiken
markharding maxmarkus ojacquemart rafaelss95 turbohappy TuiKiken
vogloblinsky edud69 idready zbarbuto Yonet Green-Cat
vogloblinsky edud69 idready zbarbuto Yonet Green-Cat
ip512 joshboley Marcelh1983 pbazurin-softheme Bigous rajeev-tripathi
ip512 joshboley Marcelh1983 pbazurin-softheme Bigous rajeev-tripathi
alexweber allenhwkim yassirh Falinor amaltsev tomlobato
alexweber allenhwkim yassirh Falinor amaltsev tomlobato
arun-awnics taguan bbarry bbogdanov sonicparke brendanbenson
arun-awnics taguan bbarry bbogdanov sonicparke brendanbenson
brian428 briantopping ckapilla cadriel Cselt dszymczuk
brian428 briantopping ckapilla cadriel Cselt dszymczuk
dmurat peah90 dstockhammer DaveSkender dwido kayveedw
dmurat peah90 dstockhammer DaveSkender dwido kayveedw
totev JimbeanZN ericdoerheit gp187 gsamokovarov koodikindral
totev JimbeanZN ericdoerheit gp187 gsamokovarov koodikindral
hkashlan hpinsley NN77 isidroamv aelbore JohnnyQQQQ
hkashlan hpinsley NN77 isidroamv aelbore JohnnyQQQQ
jeffbcross Drane johnjelinek JunusErgin justindujardin karlhiramoto
jeffbcross Drane johnjelinek JunusErgin justindujardin karlhiramoto
lihaibh Brooooooklyn tandu inkidotcom mpetkov daixtrose
lihaibh Brooooooklyn tandu inkidotcom mpetkov daixtrose
maxklenk mjwwit oferze ocombe gdi2290 typekpb
maxklenk mjwwit oferze ocombe gdi2290 typekpb
pavlovich philipooo TTy32 redian robbatt robertpenner
pavlovich philipooo TTy32 redian robbatt robertpenner
Sjiep RoxKilly SamVerschueren sclausen heavymery na-oma
Sjiep RoxKilly SamVerschueren sclausen heavymery na-oma
tapas4java tsvetomir valera-rozuvan vincentpalita VladimirMakaev Yalrafih
tapas4java tsvetomir valera-rozuvan vincentpalita VladimirMakaev Yalrafih
arioth billsworld blackheart01 butterfieldcons danielcrisp gforceg
arioth billsworld blackheart01 butterfieldcons danielcrisp gforceg
jgolla locinus omerfarukyilmaz ZuSe rossedfort ruffiem
jgolla locinus omerfarukyilmaz ZuSe rossedfort ruffiem
savcha tobiaseisenschenk ultrasonicsoft hellofornow
savcha tobiaseisenschenk ultrasonicsoft hellofornow

Change Log

You can follow the Angular change log here.

License

MIT