diff --git a/docs.json b/docs.json new file mode 100644 index 0000000..83908f8 --- /dev/null +++ b/docs.json @@ -0,0 +1,10 @@ +{ + "content": [ + { + "title": "Bootstrap API", + "depth": 2 + }, + "index.js", + "docs/configuration.md" + ] +} diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000..082e959 --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,50 @@ +## Configuration and conventions + +### Model Definitions + +The following is example JSON for two `Model` definitions: +"dealership" and "location". + +```js +{ + "dealership": { + // a reference, by name, to a dataSource definition + "dataSource": "my-db", + // the options passed to Model.extend(name, properties, options) + "options": { + "relations": { + "cars": { + "type": "hasMany", + "model": "Car", + "foreignKey": "dealerId" + } + } + }, + // the properties passed to Model.extend(name, properties, options) + "properties": { + "id": {"id": true}, + "name": "String", + "zip": "Number", + "address": "String" + } + }, + "car": { + "dataSource": "my-db" + "properties": { + "id": { + "type": "String", + "required": true, + "id": true + }, + "make": { + "type": "String", + "required": true + }, + "model": { + "type": "String", + "required": true + } + } + } +} +``` diff --git a/index.js b/index.js index 2b309e7..64158b3 100644 --- a/index.js +++ b/index.js @@ -42,56 +42,6 @@ var debug = require('debug')('loopback:boot'); * * Throws an error if the config object is not valid or if boot fails. * - * - * **Model Definitions** - * - * The following is example JSON for two `Model` definitions: - * "dealership" and "location". - * - * ```js - * { - * "dealership": { - * // a reference, by name, to a dataSource definition - * "dataSource": "my-db", - * // the options passed to Model.extend(name, properties, options) - * "options": { - * "relations": { - * "cars": { - * "type": "hasMany", - * "model": "Car", - * "foreignKey": "dealerId" - * } - * } - * }, - * // the properties passed to Model.extend(name, properties, options) - * "properties": { - * "id": {"id": true}, - * "name": "String", - * "zip": "Number", - * "address": "String" - * } - * }, - * "car": { - * "dataSource": "my-db" - * "properties": { - * "id": { - * "type": "String", - * "required": true, - * "id": true - * }, - * "make": { - * "type": "String", - * "required": true - * }, - * "model": { - * "type": "String", - * "required": true - * } - * } - * } - * } - * ``` - * * @param app LoopBack application created by `loopback()`. * @options {String|Object} options Boot options; If String, this is * the application root directory; if object, has below properties. @@ -107,7 +57,7 @@ var debug = require('debug')('loopback:boot'); * `datasources.json`. Defaults to `appRootDir`. * @end * - * @header boot(app, [options]) + * @header bootLoopBackApp(app, [options]) */ exports = module.exports = function bootLoopBackApp(app, options) {