Skip to content

oktapodia/loopback-mixin-exposition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exposition

This module is designed for the Strongloop Loopback framework. It can help to define the methods exposed each by each.

Install

  npm install --save loopback-mixin-exposition

Model configuration

Add the mixins property to your server/model-config.json:

{
  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "./models"
    ],
    "mixins": [
      "loopback/common/mixins",
      "../common/mixins",
      "../node_modules/loopback-mixin-exposition"
    ]
  }
}

Configure

To use with your Models add the mixins attribute to the definition object of your model config.

    "Exposition": {
      "properties": { // Exposed by default
        "hide": [
          "id"
        ]
      }
      "methods": { // Hidden by default
        "expose" : [
          "create",
          "find",
          "deleteById"
        ]
      }
    }

Debug

To display all the endpoints disabled by model, you can run your server with this env variable

DEBUG=loopback:mixin:exposition npm start