Skip to content

Instantly share code, notes, and snippets.

@isterin
Last active January 2, 2016 15:29
Show Gist options
  • Save isterin/8324303 to your computer and use it in GitHub Desktop.
Save isterin/8324303 to your computer and use it in GitHub Desktop.
/*
* /routes/user.js
*/
/*
* /users -> list
* /user/:id -> get
* /users/:id -> get
*
*/
exports.routes = function() {
return {
_: {
get: list,
post: post
},
':id': {
get: get
},
'/users/:id': {
get: get
}
}
}
var list = function(req, res) {
res.send("respond with a resource");
};
var post = function(req, res) {
console.log("This is a post request")
}
var get = function(req, res) {
res.send("Requested user id: " + req.params.id)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment