Skip to content

Latest commit

 

History

History
91 lines (68 loc) · 3.13 KB

README.md

File metadata and controls

91 lines (68 loc) · 3.13 KB

Node Server Skeleton

Get it running

  • Install Node, NPM and build tools: apt-get install nodejs nodejs-legacy build-essential
  • Bump Node to version 5.3.x: sudo npm install -g n && sudo n 5.3
  • Configure now, refer to the section about Configuration below.
  • Use npm run setup to perform the initial build.
  • Use npm start or a tool like PM2 to run the process.
  • Alternatively, npm run dev starts the process in development mode.

Configuration

Simply cp config/default.json config/{dest} where dest can be any of the following:

  • local.json
  • [deployment].json
  • [deployment]-[instance].json
  • [hostname].json
  • [hostname]-[instance].json
  • [hostname]-[deployment].json
  • [hostname]-[deployment]-[instance].json

Configuration files are loaded in the order shown above, where every next file overrides the previous. Any options that are left out will be loaded from default.json. local.json is always loaded, others follow the rules below:

Deployment Is matched against the NODE_ENV environment variable.

Instance Is matched against the NODE_APP_INSTANCE environment variable for different configuration files per cluster instance. Tools like PM2 set the NODE_APP_INSTANCE automatically.

Hostname Is matched against the machine host name.

For more information on configuration see the wiki.

Documentation

The Skeleton to this application has a wiki which is gradually growing and might some day be a userful resource to look at for documentation.

Tasks

  • npm run test: Cleans, lints, unit tests and integration tests.
  • npm run test:unit: Unit tests.
  • npm run test:integration: Integration tests.
  • npm run lint: Static code analysis.
  • npm run start: Start the program.
  • npm run dev: Starts the program in development mode.
  • npm run clean: Removes build files and logs.
  • npm run setup: Install dependencies, test and build.
  • npm run version: Runs the version check. Useful for other tasks.

Stack

Application

Testing

Build tools