Home

Awesome

Node API Circle CI

Coverage Status

An example of a dockerized node API built with hapijs, mongodb and mongoose.

Installation

$ npm install

Development

Watch *.js files and restart the server.

$ node start

Examples

Login with sample admin user:

$ curl -H "Content-Type: application/json" -X POST -d '{"email": "admin@admin.com", "password": "admin"}' http://localhost:9001/login

This will return a token replace <token> by that value and try retrieving the list of users:

$ curl -H "Authorization: Bearer <token>" http://localhost:9001/users

Tests

$ npm test

Coverage

$ npm run coverage

Lint

Run ESLint

$ npm run lint

Docker

Install Docker and Compose

Start docker and run:

$ docker-compose up

See docker-compose.yml and Dockerfile

Will install al dependencies, and run the api server in production mode.

Image at DockerHub dciccale/node-api-mongo-docker

Continuous Integration

With CircleCI, see circle.yml

Build url: https://circleci.com/gh/dciccale/node-api-mongo-docker