Convention-based bootstrapper for LoopBack applications
Go to file
Miroslav Bajtoš a204fdc1c9 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 19:40:52 +02:00
docs Rework model configuration 2014-06-13 19:40:52 +02:00
lib Rework model configuration 2014-06-13 19:40:52 +02:00
test Rework model configuration 2014-06-13 19:40:52 +02:00
.gitignore Load datasources and app cfg from multiple files 2014-05-27 14:08:58 +02:00
.jshintignore Custom rootDir for models and datasources 2014-05-27 14:49:11 +02:00
.jshintrc Initial commit 2014-05-23 15:51:20 +02:00
CHANGES.md Start CHANGES.md 2014-05-27 16:18:09 +02:00
CONTRIBUTING.md Initial commit 2014-05-23 15:51:20 +02:00
LICENSE Initial commit 2014-05-23 15:51:20 +02:00
README.md Change models.json to configure existing models 2014-06-10 09:21:15 +02:00
browser.js Implement compileToBrowserify and bootBrowserApp 2014-06-03 14:08:34 +02:00
docs.json Implement compileToBrowserify and bootBrowserApp 2014-06-03 14:08:34 +02:00
index.js Rework model configuration 2014-06-13 19:40:52 +02:00
package.json Implement compileToBrowserify and bootBrowserApp 2014-06-03 14:08:34 +02:00

README.md

LoopBack Boot

LoopBack Boot is a convention-based bootstrapper for LoopBack applications.

For full documentation, see the official StrongLoop documentation:

Installation

npm install loopback-boot

Usage

var loopback = require('loopback');
var boot = require('loopback-boot');

var app = loopback();
boot(app, __dirname);

app.use(loopback.rest());
app.listen();

See API docs for complete API reference.

Versions

The version range 1.x is backwards compatible with app.boot provided by LoopBack 1.x versions and the project layout scaffolded by slc lb project up to slc version 2.5.

The version range 2.x supports the new project layout as scaffolded by yo loopback.