-
-
Save bbraithwaite/9fad696fe5380baeb27c to your computer and use it in GitHub Desktop.
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'; | |
module.exports = function(app) { | |
var categories = require('../../app/controllers/categories.server.controller'); | |
app.route('/categories') | |
.get(categories.list) | |
.post(categories.create); | |
app.route('/categories/:categoryId') | |
.get(categories.read) | |
.put(categories.update) | |
.delete(categories.delete); | |
// Finish by binding the article middleware | |
// What's this? Where the categoryId is present in the URL | |
// the logic to 'get by id' is handled by this single function | |
// and added to the request object i.e. request.category. | |
app.param('categoryId', categories.categoryByID); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment