Skip to content

Instantly share code, notes, and snippets.

@ilianaza
Last active August 29, 2015 14:08
Show Gist options
  • Save ilianaza/e0575db25871c7bf7efa to your computer and use it in GitHub Desktop.
Save ilianaza/e0575db25871c7bf7efa to your computer and use it in GitHub Desktop.
loopback: hide/disable api methods by name
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