Here is a basic (truncated) callstack for a REST request to loopback.
- GET /users
- loopback.rest()
- loopback.token()
- Model.checkAccess()
- sharedMethod.invoke(argsFromHttpCtx)
- User.find()
- connector.find()
- driver.find()
- connector.find()
- User.find()
- sharedMethod.toResult(callbackArgs)
- res.send(result)
Below is the important async calls during a loopback http request:
// LoopBack Zones
loopback.rest() // 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
zone.data.ctx = new Context(req, res, app, method);
Model.currentContext = function() {
return zone.data.ctx;
}