Created
December 15, 2015 12:29
-
-
Save thebergamo/a4815c768e5fe9149fb4 to your computer and use it in GitHub Desktop.
Scoped Todo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Controller = require('../controllers/todo'); | |
const Validator = require('../validators/todo'); | |
exports.register = (server, options, next) => { | |
// instantiate controller | |
const controller = new Controller(options.database); | |
server.bind(controller); | |
server.route([ | |
{ | |
method: 'GET', | |
path: '/todo/{id}', | |
config: { | |
handler: controller.get, | |
validate: Validator.get, | |
auth: { | |
scopes: ['admin', 'owner', 'friend'] | |
} | |
} | |
}, | |
{ | |
method: 'PUT', | |
path: '/todo', | |
config: { | |
handler: controller.update, | |
validate: Validator.update, | |
auth: { | |
scopes: ['owner'] | |
} | |
} | |
} | |
]); | |
next(); | |
}; | |
exports.register.attributes = { | |
name: 'todo-route', | |
version: '1.0.1' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment