Last active
August 29, 2015 14:08
-
-
Save ilianaza/6b5f35695d8cfb705be8 to your computer and use it in GitHub Desktop.
loopback: hide/disable api methods by http verb
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
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