/angular-express-passport-seed

Web app seed including: AngularJS, ExpressJS, PassportJS, LESS styles, Mocha tests, Grunt build tasks

Primary LanguageJavaScriptMIT LicenseMIT

Seed AngularJS | ExpressJS | PassportJS

Some features included in this seed:

  • AngularJS public web site.
  • AngularJS Admin dashboard.
  • ExpressJS API with JWT-based authentication.
  • All authentication over HTTPS.
  • MongoDB Persistent user model.
  • CoffeeScript, Jade and LESS on client.
  • Bootstrap base styles.
  • Server and client tests using Mocha and Karma.

Some ideas taken from DaftMonk/generator-angular-fullstack

Prerequisites

Installation

Pre

  • nvm install within project root directory

Dependencies

  • npm install

SSL certificate for local HTTPS server

  1. Create default certificate directory:
    mkdir server/config/ssl

NOTE: If you prefer to store certificate information in a another directory inside project root, don't forget to change config files accordingly.

  • Generate key:
    openssl genrsa 1024 > server/config/ssl/key.pem

  • Generate certificate:
    openssl req -new -key server/config/ssl/key.pem -out csr.pem

  • Sign certificate:
    openssl x509 -req -days 365 -in csr.pem -signkey server/config/ssl/key.pem -out server/config/ssl/certificate.crt

  • Remove pem file:
    rm csr.pem

Certificate passphrase

If you set a SSL passphrase during certificate generation, please do one of the following:

  • If you do not have any local config files:
    Create a local config file under server/config and add the ssl.passphrase entry:
    echo "{\"ssl\": {\"passphrase\": \"%PASSPHRASE%\"}}" >> server/config/local.json

  • If you already had a local config file:
    Don't forget to add the ssl.passphrase entry with the passphrase you set.

  • As an alternative, you can also set the SSL_PASSPHRASE environment variable when running the app:
    SSL_PASSPHRASE=%PASSPHRASE% npm start

Development

  • Consistent coding style is ensured using:

Don't write a single line of code without any of this tools installed and running inside your editor.

  1. EditorConfig. Supported editors plugins
  2. ESLint.
  • Start web server: npm start
  • Seed database: npm run seed

Production environments

  • Build project: npm run dist

Test

npm test

Linting

npm run linter