This website requires JavaScript.
Explore
Help
Sign In
verdnatura-mirror
/
loopback-boot
mirror of
https://github.com/strongloop/loopback-boot.git
Watch
0
Star
0
Fork
You've already forked loopback-boot
0
Code
Issues
Packages
Projects
Releases
Wiki
Activity
c8241b2b35
loopback-boot
/
test
/
fixtures
/
browser-app
/
models
/
customer.json
6 lines
76 B
JSON
Raw
Normal View
History
Unescape
Escape
Rework model configuration Rework the way how models are configured, the goal is to allow loopback-boot to automatically determine the correct order of the model definitions to ensure base models are defined before they are extended. 1. The model .js file no longer creates the model, it exports a config function instead: ```js module.exports = function(Car, Base) { // Car is the model constructor // Base is the parent model (e.g. loopback.PersistedModel) Car.prototype.honk = function(duration, cb) { // make some noise for `duration` seconds cb(); }; }; ``` 2. The model is created by loopback-boot from model .json file. The .js file must have the same base file name. 3. The `boot()` function has a new parameter `modelSources` to specify the list of directories where to look for model definitions. The parameter defaults to `['./models']`. As a side effect, only models configured in `models.json` and their base clases are defined. This should keep the size of the browserified bundle small, because unused models are not included.
2014-06-13 11:14:43 +00:00
{
"name"
:
"Customer"
,
add support for mixins - [mixinDirs]: List of directories to look for files containing model mixin definition.
2015-04-14 09:02:09 +00:00
"base"
:
"User"
,
"mixins"
:
{
"TimeStamps"
:
{
}
}
Rework model configuration Rework the way how models are configured, the goal is to allow loopback-boot to automatically determine the correct order of the model definitions to ensure base models are defined before they are extended. 1. The model .js file no longer creates the model, it exports a config function instead: ```js module.exports = function(Car, Base) { // Car is the model constructor // Base is the parent model (e.g. loopback.PersistedModel) Car.prototype.honk = function(duration, cb) { // make some noise for `duration` seconds cb(); }; }; ``` 2. The model is created by loopback-boot from model .json file. The .js file must have the same base file name. 3. The `boot()` function has a new parameter `modelSources` to specify the list of directories where to look for model definitions. The parameter defaults to `['./models']`. As a side effect, only models configured in `models.json` and their base clases are defined. This should keep the size of the browserified bundle small, because unused models are not included.
2014-06-13 11:14:43 +00:00
}