node package manager


A user management system for the Derby JS framework.

Derby User

A user library for Derby JS. It uses Passport for authentication and Credential for storing hashes.

$ npm install derby-user --save

In your server file, add the middleware:

var user = require('derby-user');

  // ...
  // ...
  // cookieParser, session, transport, model, bodyParser...
  // ...
  // ...
  // app.router, expressApp.router
  .use('/user', user.routes())

Example route:

// subscribe to current user in each route
app.get('*', function (page, model) {
  var userId = model.get('');
  var user ='users.' + userId);
  model.subscribe(user, function (err) {
    if (err) return next(err);
    model.ref('_page.user', user);

Example signin controller function:

app.proto.signin = function (username, password) {
  var model = this.model;
  $.post('/user/signin', {
    username: username,
    password: password
  }).done(function (data) {

Example signin view:

<form on-submit="signin(username, password)">
  <input type="text" value="{username}">
  <input type="password" value="{password}">