Update JSDoc

This commit is contained in:
crandmck 2014-06-04 17:42:18 -07:00
parent c58ec57f39
commit d8c6f9d962
4 changed files with 44 additions and 27 deletions

View File

@ -1,17 +1,24 @@
/**
/*!
* Module dependencies.
*/
var loopback = require('../loopback');
/**
/*!
* Export the middleware.
*/
module.exports = rest;
/**
* Build a temp app for mounting resources.
* Expose models over REST.
*
* For example:
* ```js
* app.use(loopback.rest());
* ```
* For more information, see [Exposing models over a REST API](http://docs.strongloop.com/display/DOC/Exposing+models+over+a+REST+API).
* @header loopback.rest()
*/
function rest() {

View File

@ -1,9 +1,22 @@
/**
/*!
* Export the middleware.
*/
module.exports = status;
/**
* Return [HTTP response](http://expressjs.com/4x/api.html#res.send) with basic application status information:
* date the application was started and uptime, in JSON format.
* For example:
* ```js
* {
* "started": "2014-06-05T00:26:49.750Z",
* "uptime": 9.394
* }
* ```
*
* @header loopback.status()
*/
function status() {
var started = new Date();

View File

@ -12,14 +12,17 @@ var assert = require('assert');
module.exports = token;
/**
* **Options**
* Check for an access token in cookies, headers, and query string parameters.
* This function always checks for the following:
*
* - `cookies` - An `Array` of cookie names
* - `headers` - An `Array` of header names
* - `params` - An `Array` of param names
* - `model` - Specify an AccessToken class to use
* - `access_token`
* - `X-Access-Token`
* - `authorization`
*
* Each array is used to add additional keys to find an `accessToken` for a `request`.
* It checks for these values in cookies, headers, and query string parameters _in addition_ to the items
* specified in the options parameter.
*
* **NOTE:** This function only checks for [signed cookies](http://expressjs.com/api.html#req.signedCookies).
*
* The following example illustrates how to check for an `accessToken` in a custom cookie, query string parameter
* and header called `foo-auth`.
@ -28,23 +31,16 @@ module.exports = token;
* app.use(loopback.token({
* cookies: ['foo-auth'],
* headers: ['foo-auth', 'X-Foo-Auth'],
* cookies: ['foo-auth', 'foo_auth']
* params: ['foo-auth', 'foo_auth']
* }));
* ```
*
* **Defaults**
*
* By default the following names will be checked. These names are appended to any optional names. They will always
* be checked, but any names specified will be checked first.
*
* - **access_token**
* - **X-Access-Token**
* - **authorization**
* - **access_token**
*
* **NOTE:** The `loopback.token()` middleware will only check for [signed cookies](http://expressjs.com/api.html#req.signedCookies).
*
* @header loopback.token(options)
* @options {Object} [options] Each option array is used to add additional keys to find an `accessToken` for a `request`.
* @property {Array} [cookies] Array of cookie names.
* @property {Array} [headers] Array of header names.
* @property {Array} [params] Array of param names.
* @property {Array} [model] An AccessToken object to use.
* @header loopback.token([options])
*/
function token(options) {

View File

@ -1,13 +1,14 @@
/**
/*!
* Export the middleware.
* See discussion in Connect pull request #954 for more details
* https://github.com/senchalabs/connect/pull/954.
*/
module.exports = urlNotFound;
/**
* Convert any request not handled so far to a 404 error
* to be handled by error-handling middleware.
* See discussion in Connect pull request #954 for more details
* https://github.com/senchalabs/connect/pull/954
* @header loopback.urlNotFound()
*/
function urlNotFound() {
return function raiseUrlNotFoundError(req, res, next) {