Start strong-docs API docs.

Add docs.json with strong-docs configuration.

Extract the example of `models.json` into docs/configuration.md.
This commit is contained in:
Miroslav Bajtoš 2014-06-02 10:40:13 +02:00
parent 76d379afbc
commit 1bf94a1b49
3 changed files with 61 additions and 51 deletions

10
docs.json Normal file
View File

@ -0,0 +1,10 @@
{
"content": [
{
"title": "Bootstrap API",
"depth": 2
},
"index.js",
"docs/configuration.md"
]
}

50
docs/configuration.md Normal file
View File

@ -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
}
}
}
}
```

View File

@ -42,56 +42,6 @@ var debug = require('debug')('loopback:boot');
*
* Throws an error if the config object is not valid or if boot fails.
*
* <a name="model-definition"></a>
* **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) {