Search code examples
node.jsloopbackjsstrongloop

How to expose the Application model's register method


For context, I am creating a base REST API application using Loopback, and I intend to use the User and Application built-in models to start with.

Since each User will have Applications under his/her name (which I registered using $> slc loopback:relation), I was wondering how I can expose the register() static method of Applications so that there is a REST endpoint for it? This way I don't have to rewrite that logic when having an Application be registered under a User account.


Solution

  • Application model doesn't have remote for register() method, to expose it. Instead you should register your own remote method, where you can call Application.register()