My documentation
- http://andowebsit.es/blog/noteslog.com/post/how-to-improve-filters-with-promises/
- http://andowebsit.es/blog/noteslog.com/post/how-to-customize-morganjs/
Authentication
- https://scotch.io/tutorials/authenticate-a-node-js-api-with-json-web-tokens
- http://www.html5rocks.com/en/tutorials/es6/promises/
Mongoose
- http://mongoosejs.com/docs/guide.html
- https://github.com/madhums/node-express-mongoose-demo/blob/master/app/models/user.js
Express
MEAN
Mocha
Instanbul
$ cd server
$ npm install
$ npm install -g nodemon
$ nodemon start
Send valid credentials to get a JSON Web Token.
POST localhost:8080/api/tokens {
name: "<NAME>",
password: "<PASSWORD>"
}
Success:
{
"success": true,
"payload": "<TOKEN>"
}
Failures:
{
"success": false,
"message": "Authentication failed. Wrong name."
}
{
"success": false,
"message": "Authentication failed. Wrong password."
}
Send a valid token to get authenticated.
GET localhost:8080/api/tokens/<TOKEN>
Success:
{
"success": true,
"payload": "<User name>",
"message": "Access granted."
}
Failures:
{
"success": false,
"message": "Authentication failed. Wrong token."
}
{
"success": false,
"message": "Authentication failed. Wrong user."
}
$ npm install -g mocha
$ mocha 'test/**/*.js'
$ npm install -g istanbul