This is a very BETA project to abstract the storage and authentication requirements for basic user features on an API. This is not a full service authentication module. This is designed for rapid prototyping and is inspired upon the features available in the backlift.com user authentication project.
Too many times I have needed a drop in restful API login feature. This project, which might be a duplicate of an existing project, is designed to be a micro module and boilerplate for basic features.
This enables a public login route /api/login
to setup a session.
curl -XPOST /api/register { username: 'JoeBlow', password: 'XXXXX' }
This enables logout of a given user/session.
curl -XPOST /api/logout
This enables a /api/register
to setup a user account. The route can be configured to require an email authentication process or simply return a valid session.
curl -XPOST /api/register { username: 'JoeBlow', password: 'XXXXX', name: 'Joe Blow', city: 'Bosotn' ... }
The allows a public and private user profile. Long term the configuration for the module will allow the user to configure the values returned by both.
curl -XGET /api/profile/JoeBlow
This allows a logged in user to submit changes to their profile.
curl -XPUT /api/profile/JoeBlow { username: 'JoeBlow', password: 'XXXXX', name: 'Joe Blow', city: 'Boston', }
The module will support several storage options. Since this is designed to be boilerplate, we want this module to flexible in the storage location for user information.
- CouchDB - use the https://github.com/dominicbarnes/node-couchdb-api Node module.
- MongoDB (coming)
- Redis (coming)
- Static (future)
The following are pending configuration options.
var options = { storage: { type: 'couch', auth: { ... } }, enabled: [ 'login', 'register', 'profile public', 'profile private', 'profile update', or 'all' ] }; var userize = require('userize')( options );
The following are pending configuration options.
- Change the express routes as needed.
- Define the data fields to return for public and private profile requests.
- Define storage options in the server setup.
This module is not ready for npm
. Once it completed and submitted, it will installable using. npm install userize