$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
$ nvm install 4
$ nvm use 4
$ npm install
$ npm test
$ npm test
$ npm start
(set environment variables to whatever you've configured)
NODE_ENV=productionAlter \
DBHOST=localhost \
DBPORT=3306 \
DBUSER=root \
DBPASS=root \
DBNAME=sails \
REDIS_SERVICE_HOST=localhost \
REDIS_SERVICE_PORT=6379 \
PORT=8080 \
npm start
VAR | OPTION | RESULT |
---|---|---|
NODE_ENV | production | start in a production mode, use a mysql db, use redis, no fixtures, do not run migrations |
NODE_ENV | productionAlter | start in a production mode, use a mysql db, use redis, no fixtures, do run migrations |
NODE_ENV | development | start in a development mode, use a local in-memory database, no fixtures, no redis |
PORT | [integer] | port to run node server on |
DBHOST | [string] | mysql db host |
DBPORT | [string] | mysql db port |
DBUSER | [string] | mysql db user |
DBPASS | [string] | mysql db password |
REDIS_SERVICE_HOST | [string] | redis host |
REDIS_SERVICE_PORT | [string] | redis port |
Can be built and run in the same way with docker for example:
$ docker build -t ibm-backend .
$ docker run -i -e "NODE_ENV=development" ibm-backend