Sails-api-bearer-kit

Build Status

This is starter kit for API with Sails.js, passport-local, passport-bearer

!!! IMPORTANT: Use at your own risk. This is pretty basic example. Have fun!

Installing

  1. Install Sails.js
$ sudo npm install sails -g
  1. Clone the project and get in
$ git clone https://github.com/Igor-lkm/sails-api-bearer-kit.git
$ cd sails-api-bearer-kit
  1. npm install install dependencies
$ npm install
  1. Run test
$ npm test
  1. If everything is ok, then provide settings for your connection in config/connections.js
mongodbServerOne: {
    adapter: 'sails-mongo',
    host: 'localhost',
    port: 27017,
    user: '***',
    password: '***',
    database: '***',
},
  1. Start the porject
$ sails lift
  1. Test your api with POSTMAN

Api endpoints:

URL HTTP Verb Arguments
/v1/signup POST email, password
/v1/login POST email, password
/v1/forgot POST email
/v1/reset POST resetToken
/v1/topSecret POST (bearer token)

Testing

To run test:

npm test

Packeges

  • passport - is authentication middleware for Node.js.
  • passport-local - passport strategy for authenticating with a username and password.
  • passport-http-bearer - HTTP Bearer authentication strategy for Passport.
  • jsonwebtoken - an implementation of JSON Web Tokens.
  • winston - a multi-transport async logging library for node.js.
  • moment - a lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.
  • bcrypt - lib to help you hash passwords.

Testing:

  • barrels - simple DB Fixtures for Sails.js with associations support
  • mocha - is a feature-rich JavaScript test framework running on node.js
  • sails-memory - non-persistent in-memory adapter for Sails.js / Waterline
  • should - should is an expressive, readable, framework-agnostic assertion library.
  • supertest - Super-agent driven library for testing HTTP servers

Some references:

Feel free to contribute the project!

License

MIT License Copyright © 2014 Igor Likhomanov