Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.