Skip to content

Instantly share code, notes, and snippets.

@thebergamo
Created December 4, 2015 16:43
Show Gist options
  • Save thebergamo/058e64b6afceebdcb783 to your computer and use it in GitHub Desktop.
Save thebergamo/058e64b6afceebdcb783 to your computer and use it in GitHub Desktop.
Users Controller - Get method
// [GET] /user/{id}
UserController.prototype.get = function (request, reply) {
let id = request.params.id;
this.model.findOneAsync({_id: id})
.then((user) => {
if (!user) {
reply(Boom.notFound());
return;
}
reply(user);
})
.catch((err) => {
reply(Boom.badImplementation(err.message));
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment