From 330292c7f27859e22e0845954fc234ed68749e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Thu, 13 Nov 2014 13:30:44 +0100 Subject: [PATCH] server-app: improve jsdoc comments --- lib/server-app.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/server-app.js b/lib/server-app.js index 4a55f108..ac8e09ea 100644 --- a/lib/server-app.js +++ b/lib/server-app.js @@ -30,11 +30,18 @@ module.exports = function loopbackExpress() { * * @param {function} factory The factory function creating a middleware handler. * Typically a result of `require()` call, e.g. `require('compression')`. - * @param {Array|*} config The configuration. Either an array of arguments - * to pass to the factory function, or the value of the first argument - * when the factory expects a single argument only. + * @options {Object} config The configuration. + * @property {String} phase The phase to register the middelware in. + * @property {Boolean} [enabled] Whether the middleware is enabled. + * Default: `true`. + * @property {Array|*} [params] The arguments to pass to the factory + * function. Either an array of arguments, + * or the value of the first argument when the factory expects + * a single argument only. * * @returns {object} this (fluent API) + * + * @header app.middlewareFromConfig(factory, config) */ proto.middlewareFromConfig = function(factory, config) { assert(typeof factory === 'function', '"factory" must be a function'); @@ -87,6 +94,8 @@ proto.middlewareFromConfig = function(factory, config) { * names to add. * * @returns {object} this (fluent API) + * + * @header app.defineMiddlewarePhases(nameOrArray) */ proto.defineMiddlewarePhases = function(nameOrArray) { this.lazyrouter(); @@ -107,6 +116,8 @@ proto.defineMiddlewarePhases = function(nameOrArray) { * `function(req, res, next)` or * `function(err, req, res, next)` * @returns {object} this (fluent API) + * + * @header app.middleware(name, handler) */ proto.middleware = function(name, handler) { this.lazyrouter();