Skip to content

Instantly share code, notes, and snippets.

@nlf
Created December 23, 2014 18:51
Show Gist options
  • Save nlf/f55bf94b596400a801de to your computer and use it in GitHub Desktop.
Save nlf/f55bf94b596400a801de to your computer and use it in GitHub Desktop.
exports.index = {
auth: 'session',
handler: function (request, reply) {
reply('resource index');
}
};
exports.create = {
auth: 'session',
handler: function (request, reply) {
reply('resource create');
}
};
exports.read = {
auth: 'session',
handler: function (request, reply) {
reply('resource read', request.params.id);
}
};
var Resource = require('./resource');
exports.register = function (server, options, next) {
server.route({ method: 'GET', path: '/resources', config: Resource.index });
server.route({ method: 'POST', path: '/resources', config: Resource.create });
server.route({ method: 'GET', path: '/resources/{id}', config: Resource.read });
next();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment