loopback
loopback copied to clipboard
Question about loopback models
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
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.