Skip to content

Instantly share code, notes, and snippets.

@artcommacode
Created April 22, 2014 14:17
Show Gist options
  • Save artcommacode/11180943 to your computer and use it in GitHub Desktop.
Save artcommacode/11180943 to your computer and use it in GitHub Desktop.
var Restify = require('cms-restify')
, modelify = require('cms-modelify')
, routify = require('cms-routify')
, users = {};
module.exports = function (app, db) {
users.model = modelify('User', {
email: {
type: String,
required: true
},
name: {
type: String,
required: true
},
password: {
type: String,
required: true
},
lastLoggedIn: {
type: Date
}
}, db);
users.controller = new Restify({
Model: users.model,
controller: 'users',
single: 'user'
});
users.routes = routify(users.controller);
app.use('/users', users.routes);
return users;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment