包详细信息

loopback-boot

strongloop72kMIT3.3.1

Convention-based bootstrapper for LoopBack applications

StrongLoop, LoopBack, Configuration, Bootstrap

自述文件

LoopBack Boot

This module is in Active LTS mode, new features are no longer accepted.
(See Module Long Term Support Policy below.)

LoopBack 3 users looking for new features are encouraged to upgrade to LoopBack 4. Refer to loopback-next#1849 for more information on how to upgrade.

Overview

A convention-based bootstrapper for LoopBack applications.

For full documentation, see the official StrongLoop documentation: Defining boot scripts and Creating a LoopBack application.

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 Defining boot scripts.

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.

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.

Module Long Term Support Policy

This module adopts the Module Long Term Support (LTS) policy, with the following End Of Life (EOL) dates:

Version Status Published EOL
3.x Active LTS May 2017 Dec 2020
2.x End-of-Life Jul 2014 Apr 2019

Learn more about our LTS plan in docs.

License

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

更新日志

2019-06-24, Version 3.3.1

  • chore: update LTS status (Diana Lau)

  • chore: update copyrights years (Agnes Lin)

2019-03-28, Version 3.3.0

  • chore: upgrade deps to avoid npm audit warnings (Raymond Feng)

2019-03-22, Version 3.2.1

  • fix: set app.booting flag immediately (Miroslav Bajtoš)

  • fix: update lodash (jannyHou)

2018-10-18, Version 3.2.0

  • README: update LTS status (Miroslav Bajtoš)

  • Add support for es6 modules for boot scripts (Walker)

2018-07-26, Version 3.1.1

  • update: dependency (jannyHou)

  • chore: update dependencies (Diana Lau)

  • [WebFM] cs/pl/ru translation (candytangnb)

  • chore: update license (Diana Lau)

  • CODEOWNERS: move @lehni to Alumni section (Miroslav Bajtoš)

  • Add support for ES6 style async boot scripts (Jürg Lehni)

2017-10-13, Version 3.1.0

  • update strong-globalize to 3.1.0 (shimks)

  • CODEOWNERS: add zbarbuto (Miroslav Bajtoš)

  • Ignore source maps in boot (Zak Barbuto)

  • CODEOWNERS: add lehni (Miroslav Bajtoš)

  • Create Issue and PR Templates (#261) (Sakib Hasan)

  • Add CODEOWNER file (Diana Lau)

2017-06-22, Version 3.0.1

  • Update Italian translated strings Q2 2017 (Allen Boone)

  • Update translated strings Q2 2017 (Allen Boone)

  • Replicate new issue_template from loopback (Siddhi Pai)

  • Replicate issue_template from loopback repo (Siddhi Pai)

2017-05-22, Version 3.0.0

  • Upgrade deps and fix style issues (Raymond Feng)

  • Provide scriptExtensions option (Supasate Choochaisri)

  • Update paid support URL (Siddhi Pai)

  • Refactor for modular and pluggable design (Raymond Feng)

  • Add Node v7 to Travis CI platforms (Miroslav Bajtoš)

  • Drop support for Node v0.10 and v0.12 (Miroslav Bajtoš)

  • readme: update URL to new doc site (David Cheung)

  • Update ja translation file (Candy)

  • Update header-browser.md (Sequoia McDowell)

  • Update translation files - round#2 (Candy)

  • Normalize line endings to support both LF and CRLF (Miroslav Bajtoš)

  • Remove "defaultForType" from datasource config (Miroslav Bajtoš)

  • Update deps to loopback 3.0.0 RC (Miroslav Bajtoš)

  • globalization: add translated strings (gunjpan)

  • Start development of 3.0 (Miroslav Bajtoš)

2016-09-05, Version 2.22.0

  • Replace fs.existsSync calls with fs.statSync (Joshua Estrin Skrzypek)

  • Change test cases port to be dynamic (David Cheung)

  • Globalization for Loopback-boot (David Cheung)

2016-07-27, Version 2.21.0

  • Configurable dir for components and middleware (Doped Dude)

  • test: fix security warning (Miroslav Bajtoš)

2016-07-14, Version 2.20.0

  • Update URLs in CONTRIBUTING.md (#198) (Ryan Graham)

  • travis: drop io.js, add Node v4 and v6 (Miroslav Bajtoš)

  • Stop caching config files (Miroslav Bajtoš)

2016-06-20, Version 2.19.0

  • update copyright notices and license (Ryan Graham)

  • Add flag var lazyConnect to ds config (juehou)

2016-04-13, Version 2.18.1

  • parse config: should ignore null values (Loïc Mahieu)

2016-04-07, Version 2.18.0

  • Dynamic datasources.json from ENV and config.json (David Cheung)

  • Use eslint with loopback config (Miroslav Bajtoš)

2016-02-23, Version 2.17.0

  • executor: move "booted" and cb() to the next tick (Miroslav Bajtoš)

  • Fix lodash 4.0.0 breaking changes (Jérémie Drouet)

  • When config is overriden with null don't merge (Farid Neshat)

2015-12-22, Version 2.16.0

  • executor: allow loopback versions >= 3.0.0-alpha (Miroslav Bajtoš)

2015-12-04, Version 2.15.0

  • Bluemix prefers HOST/PORT over VCAP_APP_XXXX (Sai Vennam)

  • Set app env if it is supplied in options object (Amir Jafarian)

2015-11-24, Version 2.14.2

  • executor: preserve RegExps in middleware paths (Miroslav Bajtoš)

2015-11-24, Version 2.14.1

  • Warn user if missing a config file (Amir Jafarian)

  • Refer to licenses with a link (Sam Roberts)

2015-10-14, Version 2.14.0

  • Support bluemix env variables for host and port (Miroslav Bajtoš)

2015-10-01, Version 2.13.0

  • add env folder for boot (yorkie)

  • Use strongloop conventions for licensing (Sam Roberts)

2015-09-09, Version 2.12.2

  • test: fix strict mode failure (Ryan Graham)

2015-08-31, Version 2.12.1

  • Add config variable checks (Simon Ho)

2015-08-28, Version 2.12.0

  • Resolve ${var} values in component-config.json (Hage Yaapa)

  • Resolve ${var} values in middleware.json (Hack Sparrow)

  • Upgrade Travis to container-based infrastructure (Miroslav Bajtoš)

2015-08-11, Version 2.11.0

  • Allow middleware array merge by a key in item objects (Raymond Feng)

2015-08-10, Version 2.10.0

  • Enhance middleware config merge (Raymond Feng)

2015-08-03, Version 2.9.0

  • Fix the build failure (Raymond Feng)

  • Fix the model-config/datasource merge (Raymond Feng)

  • Resolved style issue (Dennis Ashby)

  • Added code to allow model-config to respect model-config.local.js and model-config.env.js as do other config files. (Dennis Ashby)

  • Add jsdoc for options.mixinSources (Miroslav Bajtoš)

  • allow middleware to be optional (Hage Yaapa)

2015-06-24, Version 2.8.2

  • Excl. mod. main path from middleware instructions (Miroslav Bajtoš)

2015-06-10, Version 2.8.1

  • Add more debug info for config loading (Ritchie Martori)

  • use a new variable for better debug output (Bryan Clark)

2015-05-29, Version 2.8.0

  • Support iisnode using named pipes as PORT value (Jonathan Sheely)

  • support 'mixinsources' option (Pradnya Baviskar)

  • compiler: Simplify verifyModelDefinitions() (Miroslav Bajtoš)

  • Fix coding style issues, add API docs (Miroslav Bajtoš)

  • Extend options arg to support custom model definitions (Shlomi Assaf)

  • add support for mixins - [mixinDirs]: List of directories to look for files containing model mixin definition. (Pradnya Baviskar)

2015-04-23, Version 2.7.1

  • executor: fix port lookup (Miroslav Bajtoš)

  • Clean up compiler.tryResolveAppPath (Miroslav Bajtoš)

  • Configure Travis CI builds (Miroslav Bajtoš)

2015-04-15, Version 2.7.0

  • Upgrade lodash and drop underscore.string (Bryan Clark)

  • add console.error message to a bad require in a boot script (Bryan Clark)

  • Support per-application registry of models (Miroslav Bajtoš)

  • Use filename as default value for Model name (Pradnya Baviskar)

  • compiler: code cleanup (Miroslav Bajtoš)

  • Improve the resolution of relative paths - resolve module relative path for component - prioritize coffeescript over json (Pradnya Baviskar)

  • Resolve module paths as relative to appRootDir - for middleware (Pradnya Baviskar)

  • Support for multiple apps in browserified bundle. (Krishna Raman)

  • Resolve missing file extension for module relative paths (Pradnya Baviskar)

  • Resolve module paths as relative to appRootDir (Pradnya Baviskar)

  • Resolve relative paths in using appRootDir (Pradnya Baviskar)

  • Add feature to disable component (Pradnya Baviskar)

  • Fix test for different line endings on Windows (Pradnya Baviskar)

  • Refactor unit test assertions to be more specific (Simon Ho)

  • Add unit test to verify `app.booting flag status (Simon Ho)

2015-02-20, Version 2.6.5

2015-02-02, Version 2.6.4

  • executor: pass correct this to middleware (Clark Wang)

  • Fix broken links (Rand McKinney)

2015-01-13, Version 2.6.3

2015-01-13, Version 2.6.2

  • Don't swallow error when a sub-dependency doesn't resolve. (Samuel Reed)

2015-01-12, Version 2.6.1

  • Fix "incompatible loopback version" check & msg (Miroslav Bajtoš)

2015-01-08, Version 2.6.0

  • Add "booting" flag and emit "booted" event (Simon Ho)

  • Configure components via component-config.json (Miroslav Bajtoš)

  • Fix bad CLA URL in CONTRIBUTING.md (Ryan Graham)

2014-12-19, Version 2.5.2

  • Dedupe boot scripts (Eric Satterwhite)

2014-12-08, Version 2.5.1

  • Replace underscore with lodash (Ryan Graham)

2014-12-02, Version 2.5.0

  • compiler: resolve paths in middleware params (Miroslav Bajtoš)

2014-11-27, Version 2.4.0

  • Implement shorthand notation for middleware paths (Raymond Feng)

  • Load middleware and phases from middleware.json (Miroslav Bajtoš)

  • Add jscs style check, fix violations found (Miroslav Bajtoš)

  • Clean up .jshintrc (Miroslav Bajtoš)

  • Use chai instead of must (Miroslav Bajtoš)

2014-11-10, Version 2.3.1

  • Bump version (Raymond Feng)

  • Fix the test for built-in models on Windows (Raymond Feng)

  • Fix jsdoc (Raymond Feng)

2014-10-27, Version 2.3.0

  • compiler: fix coding style violations (Miroslav Bajtoš)

  • support coffee-script models and client code (bitmage)

2014-10-22, Version 2.2.0

  • compiler: support module-relative model sources (Miroslav Bajtoš)

  • Skip definitions of built-in loopback models (Miroslav Bajtoš)

  • package: update dependency versions (Miroslav Bajtoš)

  • Use loopback 2.x in unit tests. (Miroslav Bajtoš)

2014-10-09, Version 2.1.0

  • Bump version (Raymond Feng)

  • Add support for async boot scripts (Raymond Feng)

  • Clean up jsdoc comments. (Miroslav Bajtoš)

  • Custom rootDir for app config (johnsoftek)

  • compiler: improve merging of Arrays and Objects (Miroslav Bajtoš)

  • config-loader: deeply merge Array and Object vals (Shelby Sanders)

  • gitignore: add Idea's *.iml files (Miroslav Bajtoš)

  • package: Add jshint to devDependencies (Miroslav Bajtoš)

  • Update contribution guidelines (Ryan Graham)

  • test: ensure sandbox dir is present (Miroslav Bajtoš)

  • test: add global.navigator for browser tests (Miroslav Bajtoš)

  • test: increase timeout for browserify (Miroslav Bajtoš)

  • index: fix jshint error (Miroslav Bajtoš)

  • documentation fix (Alex)

  • Fix typo (Fabien Franzen)

  • Implemented modelSources, bootDirs and bootScripts options (Fabien Franzen)

2014-07-22, Version 2.0.0

  • executor: remove Base arg from model function (Miroslav Bajtoš)

  • package: update dependency versions (Miroslav Bajtoš)

2014-07-17, Version v2.0.0-beta3

  • compiler: return a clone of instructions (Miroslav Bajtoš)

2014-07-17, Version 2.0.0-beta2

  • test: export Int32Array and DataView for browser (Miroslav Bajtoš)

  • v2.0.0-beta2 (Miroslav Bajtoš)

  • Rename models.json to model-config.json (Miroslav Bajtoš)

  • Remove non-API docs. (Rand McKinney)

2014-06-26, Version 2.0.0-beta1

  • test: fix jshint warnings (Miroslav Bajtoš)

  • compiler: fix references to loopback (Miroslav Bajtoš)

  • Rename app.json to config.json (Miroslav Bajtoš)

  • compiler: Sort models topologically (Miroslav Bajtoš)

  • executor: Split model boot into two phases (Miroslav Bajtoš)

  • compiler: Move model-sources cfg to models.json (Miroslav Bajtoš)

  • package: Bump up the version to 2.0.0-dev (Miroslav Bajtoš)

  • Rework model configuration (Miroslav Bajtoš)

  • Remove auto-attach. (Miroslav Bajtoš)

  • Change models.json to configure existing models (Miroslav Bajtoš)

2014-06-26, Version 1.1.0

  • docs: move hand-written content to README.md (Miroslav Bajtoš)

  • executor: remove direct reference to loopback (Miroslav Bajtoš)

  • Update link to doc (Rand McKinney)

  • package: Fix repository url (Miroslav Bajtoš)

  • Drop peer dep on loopback; add a runtime check (Miroslav Bajtoš)

  • Wrap too long lines (Miroslav Bajtoš)

  • Add disclaimer to JSDoc and small correction. (crandmck)

2014-06-05, Version 1.0.0

  • First release!