Merge pull request #146 from strongloop/feature/DFD-48

Clean up loopback.js doc and add it to docs.json
This commit is contained in:
Raymond Feng 2014-01-17 11:04:38 -08:00
commit f887c3e623
2 changed files with 21 additions and 6 deletions

View File

@ -2,6 +2,8 @@
"title": "LoopBack Documentation", "title": "LoopBack Documentation",
"content": [ "content": [
"lib/application.js", "lib/application.js",
{"title": "LoopBack", "depth": 3},
"lib/loopback.js",
{"title": "Middleware", "depth": 3}, {"title": "Middleware", "depth": 3},
"lib/middleware/token.js", "lib/middleware/token.js",
"lib/models/access-token.js", "lib/models/access-token.js",

View File

@ -1,4 +1,4 @@
/** /*!
* Module dependencies. * Module dependencies.
*/ */
@ -15,7 +15,15 @@ var express = require('express')
, i8n = require('inflection'); , i8n = require('inflection');
/** /**
* Expose `createApplication()`. * `loopback` is the main entry for LoopBack core module. It provides static
* methods to create models and data sources. The module itself is a function
* that creates loopback `app`. For example,
*
*
* ```js
* var loopback = require('loopback');
* var app = loopback();
* ```
*/ */
var loopback = exports = module.exports = createApplication; var loopback = exports = module.exports = createApplication;
@ -47,7 +55,7 @@ function createApplication() {
return app; return app;
} }
/** /*!
* Expose express.middleware as loopback.* * Expose express.middleware as loopback.*
* for example `loopback.errorHandler` etc. * for example `loopback.errorHandler` etc.
*/ */
@ -59,7 +67,7 @@ for (var key in express) {
, Object.getOwnPropertyDescriptor(express, key)); , Object.getOwnPropertyDescriptor(express, key));
} }
/** /*!
* Expose additional loopback middleware * Expose additional loopback middleware
* for example `loopback.configure` etc. * for example `loopback.configure` etc.
*/ */
@ -73,7 +81,7 @@ fs
loopback[m.replace(/\.js$/, '')] = require('./middleware/' + m); loopback[m.replace(/\.js$/, '')] = require('./middleware/' + m);
}); });
/** /*!
* Error handler title * Error handler title
*/ */
@ -197,6 +205,9 @@ loopback.getModel = function(modelName) {
/** /**
* Set the default `dataSource` for a given `type`. * Set the default `dataSource` for a given `type`.
* @param {String} type The datasource type
* @param {Object|DataSource} dataSource The data source settings or instance
* @return {DataSource} The data source instance
*/ */
loopback.setDefaultDataSourceForType = function(type, dataSource) { loopback.setDefaultDataSourceForType = function(type, dataSource) {
@ -212,6 +223,8 @@ loopback.setDefaultDataSourceForType = function(type, dataSource) {
/** /**
* Get the default `dataSource` for a given `type`. * Get the default `dataSource` for a given `type`.
* @param {String} type The datasource type
* @return {DataSource} The data source instance
*/ */
loopback.getDefaultDataSourceForType = function(type) { loopback.getDefaultDataSourceForType = function(type) {
@ -262,7 +275,7 @@ loopback.RoleMapping = require('./models/role').RoleMapping;
loopback.ACL = require('./models/acl').ACL; loopback.ACL = require('./models/acl').ACL;
loopback.Scope = require('./models/acl').Scope; loopback.Scope = require('./models/acl').Scope;
/** /*!
* Automatically attach these models to dataSources * Automatically attach these models to dataSources
*/ */