Skip to content

Instantly share code, notes, and snippets.

@ilianaza
Last active August 29, 2015 14:08
Show Gist options
  • Save ilianaza/6b5f35695d8cfb705be8 to your computer and use it in GitHub Desktop.
Save ilianaza/6b5f35695d8cfb705be8 to your computer and use it in GitHub Desktop.
loopback: hide/disable api methods by http verb
module.exports = function(Lesson) {
/*
"get":
GET /lessons
GET /lessons/{id}
GET /lessons/findOne
GET /lessons/count
"post":
POST /lessons
POST /lessons/update
"put":
PUT /lessons
PUT /lessons/{id}
"del":
DELETE /lessons/{id}
undefined:
HEAD /lessons/{id}
GET /lessons/{id}/exists
*/
var hideHttpVerbs = [ "get", "post", "put", "del", undefined ]
Lesson.sharedClass.methods().forEach(function(method) {
if(hideHttpVerbs.indexOf(method.http.verb) > -1) {
method.shared = false;
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment