Last active
August 29, 2015 14:08
-
-
Save ilianaza/e0575db25871c7bf7efa to your computer and use it in GitHub Desktop.
loopback: hide/disable api methods by name
This file contains hidden or 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) { | |
// Hide methods by method name | |
var hideMethods = [ | |
"create", // POST /lessons | |
"find", // GET /lessons | |
"upsert", // PUT /lessons | |
"updateAttributes", // PUT /lessons/{id} | |
"exists", // HEAD /lessons/{id} or GET /lessons/{id}/exists | |
"findById", // GET /lessons/{id} | |
"deleteById", // DELETE /lessons/{id} | |
"count", // GET /lessons/count | |
"findOne", // GET /lessons/findOne | |
"updateAll" // POST /lessons/update | |
] | |
Lesson.sharedClass.methods().forEach(function(method) { | |
if(hideMethods.indexOf(method.name) > -1) { | |
method.shared = false; | |
} | |
}); | |
// Hide methods by http verb | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment