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:
parent
76d379afbc
commit
1bf94a1b49
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"title": "Bootstrap API",
|
||||||
|
"depth": 2
|
||||||
|
},
|
||||||
|
"index.js",
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
52
index.js
52
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.
|
* 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()`.
|
* @param app LoopBack application created by `loopback()`.
|
||||||
* @options {String|Object} options Boot options; If String, this is
|
* @options {String|Object} options Boot options; If String, this is
|
||||||
* the application root directory; if object, has below properties.
|
* the application root directory; if object, has below properties.
|
||||||
|
@ -107,7 +57,7 @@ var debug = require('debug')('loopback:boot');
|
||||||
* `datasources.json`. Defaults to `appRootDir`.
|
* `datasources.json`. Defaults to `appRootDir`.
|
||||||
* @end
|
* @end
|
||||||
*
|
*
|
||||||
* @header boot(app, [options])
|
* @header bootLoopBackApp(app, [options])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports = module.exports = function bootLoopBackApp(app, options) {
|
exports = module.exports = function bootLoopBackApp(app, options) {
|
||||||
|
|
Loading…
Reference in New Issue