You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* This function takes an optional argument that is either a string or an object.
382
-
*
383
-
* If the argument is a string, then it sets the application root directory based on the string value. Then it:
384
-
* 1. Creates DataSources from the `datasources.json` file in the application root directory.
385
-
* 2. Creates Models from the `models.json` file in the application root directory.
386
-
*
387
-
* If the argument is an object, then it looks for `model`, `dataSources`, and `appRootDir` properties of the object.
388
-
* If the object has no `appRootDir` property then it sets the current working directory as the application root directory.
389
-
* Then it:
390
-
* 1. Creates DataSources from the `options.dataSources` object.
391
-
* 2. Creates Models from the `options.models` object.
392
-
*
393
-
* In both cases, the function loads JavaScript files in the `/models` and `/boot` subdirectories of the application root directory with `require()`.
394
-
*
395
-
* **NOTE:** mixing `app.boot()` and `app.model(name, config)` in multiple
396
-
* files may result in models being **undefined** due to race conditions.
397
-
* To avoid this when using `app.boot()` make sure all models are passed as part of the `models` definition.
398
-
*
399
-
* Throws an error if the config object is not valid or if boot fails.
400
-
*
401
-
* <a name="model-definition"></a>
402
-
* **Model Definitions**
403
-
*
404
-
* The following is example JSON for two `Model` definitions: "dealership" and "location".
405
-
*
406
-
* ```js
407
-
* {
408
-
* "dealership": {
409
-
* // a reference, by name, to a dataSource definition
410
-
* "dataSource": "my-db",
411
-
* // the options passed to Model.extend(name, properties, options)
412
-
* "options": {
413
-
* "relations": {
414
-
* "cars": {
415
-
* "type": "hasMany",
416
-
* "model": "Car",
417
-
* "foreignKey": "dealerId"
418
-
* }
419
-
* }
420
-
* },
421
-
* // the properties passed to Model.extend(name, properties, options)
422
-
* "properties": {
423
-
* "id": {"id": true},
424
-
* "name": "String",
425
-
* "zip": "Number",
426
-
* "address": "String"
427
-
* }
428
-
* },
429
-
* "car": {
430
-
* "dataSource": "my-db"
431
-
* "properties": {
432
-
* "id": {
433
-
* "type": "String",
434
-
* "required": true,
435
-
* "id": true
436
-
* },
437
-
* "make": {
438
-
* "type": "String",
439
-
* "required": true
440
-
* },
441
-
* "model": {
442
-
* "type": "String",
443
-
* "required": true
444
-
* }
445
-
* }
446
-
* }
447
-
* }
448
-
* ```
449
-
* @options {String|Object} options Boot options; If String, this is the application root directory; if object, has below properties.
450
-
* @property {String} appRootDir Directory to use when loading JSON and JavaScript files (optional). Defaults to the current directory (`process.cwd()`).
0 commit comments