loopback icon indicating copy to clipboard operation
loopback copied to clipboard

Question about loopback models

Open Spark-star opened this issue 12 years ago • 1 comments

Hi, everyone. I have to create two apps which have same models and relations between model, but they have different acls and remote methods. How can I create models that two apps can use but they have separate acl and remote method? THX

Spark-star avatar Nov 10 '14 04:11 Spark-star

The quick and dirty way is to copy the model definitions into two apps. If you are looking ways to package the common models into a npm module and share them across apps, we're working on the component architecture to enable that.

BTW, in the server/model-config.json, model definitions can be referenced, for example,

{
  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "./models"
    ]
  },

We also added the ACL support in the model-config.json with https://github.com/strongloop/loopback/pull/745.

raymondfeng avatar Nov 10 '14 06:11 raymondfeng