server-app: improve jsdoc comments

This commit is contained in:
Miroslav Bajtoš 2014-11-13 13:30:44 +01:00
parent 7647339675
commit 330292c7f2
1 changed files with 14 additions and 3 deletions

View File

@ -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();