diff --git a/docs.json b/docs.json index 478a791d..66031308 100644 --- a/docs.json +++ b/docs.json @@ -9,6 +9,7 @@ "lib/model.js", "lib/persisted-model.js", { "title": "Middleware", "depth": 2 }, + "lib/middleware/context.js", "lib/middleware/rest.js", "lib/middleware/static.js", "lib/middleware/status.js", diff --git a/lib/middleware/context.js b/lib/middleware/context.js index 275a78d9..7b21561d 100644 --- a/lib/middleware/context.js +++ b/lib/middleware/context.js @@ -25,6 +25,20 @@ function createContext(scope) { return ns; } +/** + * Context middleware. + * ```js + * var app = loopback(); + * app.use(loopback.context(options); + * app.use(loopback.rest()); + * app.listen(); + * ``` + * @options {Object} [options] Options for context + * @property {String} name Context scope name. + * @property {Boolean} enableHttpContext Whether HTTP context is enabled. Default is false. + * @header loopback.context([options]) + */ + function context(options) { options = options || {}; var scope = options.name || name; @@ -62,7 +76,7 @@ function ChainedContext(child, parent) { this.parent = parent; } -/** +/*! * Get the value by name from the context. If it doesn't exist in the child * context, try the parent one * @param {String} name Name of the context property