Code Monkey home page Code Monkey logo

angular-seed-express's Introduction

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

Change Log

You can follow the Angular change log here.

License

MIT

angular-seed-express's People

Contributors

mgechev avatar vyakymenko avatar ludohenin avatar greenkeeper[bot] avatar joshwiens avatar shyam-chen avatar karlhaas avatar tarlepp avatar nightapes avatar robstoll avatar nathanwalker avatar hankehly avatar nareshbhatia avatar kiuka avatar fr-esco avatar salemdar avatar thedondope avatar jesperronn avatar daniru avatar patrickmichalina avatar arnaudpel avatar nhutcorp avatar netstart avatar sasikumardr avatar aboeglin avatar eppsilon avatar karasuni avatar markwhitfeld avatar ryzy avatar gkalpak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.