Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How might we zonify loopback?

Here is a basic (truncated) callstack for a REST request to loopback.

  • GET /users
    • loopback.token()
    • Model.checkAccess()
    • sharedMethod.invoke(argsFromHttpCtx)
      • User.find()
        • connector.find()
          • driver.find()
    • sharedMethod.toResult(callbackArgs)
    • res.send(result)

Below is the important async calls during a loopback http request:

// LoopBack Zones // async (middleware)
loopback.token() // async (middleware)
Model.checkAccess() // async 
sharedMethod.invoke(argsFromHttpCtx) // async
// Juggler (Connector) Zones
driver.find(..., callback); // async

Proposed Zones

Request // done-ish (should set data.req and data.res)
  Access Control // loopback/lib/middleware/token.js 
    Remote Method Invocation // strong-remoting/lib/shared-method.js
      [Driver Invocation] // juggler/lib/dao.js ***

Proposed Invocation Context = new Context(req, res, app, method);

Model.currentContext = function() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.