Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

offlinehacker-loopback-boot

strongloop42.0.0-beta4

Convention-based bootstrapper for LoopBack applications

StrongLoop, LoopBack, Configuration, Bootstrap

readme

LoopBack Boot

A convention-based bootstrapper for LoopBack applications.

For full documentation, see the official StrongLoop documentation: Application initialization and Creating a LoopBack application.

Overview

The loopback-boot module initializes (bootstraps) a LoopBack application. Specifically, it:

  • Configures data-sources.
  • Defines custom models
  • Configures models and attaches models to data-sources.
  • Configures application settings
  • Runs additional boot scripts, so you can put custom setup code in multiple small files instead of in the main application file.

For more information, see Application initialization.

Version notes

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.

This document describes the configuration conventions of the 2.x versions. See the official documentation for instructions on upgrading existing projects.

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.

License

This module is provided under dual MIT/StrongLoop license. See LICENSE for details.

changelog

Changes in version 1.0

  • New options: modelsRootDir, dsRootDir

  • Load configuration from files, support dynamic (scripted) options

     app.json, app.local.*, app.{env}.*
     datasources.json, datasources.local.*, datasources.{env}.*
  • Scripts in models/ and boot/ can export function(app), this function is then called by the bootstrapper. The existing code using var app = require('../app') will continue to work.