2.8.0
* Expose more loopback middleware for require (Raymond Feng)
* Scope app middleware to a list of paths (Miroslav Bajtoš)
* Update CONTRIBUTING.md (Alex Voitau)
* Fix the model name for hasMany/through relation (Raymond Feng)
* Fixing the model attach (wfgomes)
* Minor: update jsdoc for PersistedModel.updateAll (Alex Voitau)
* AccessToken: optional `options` in findForRequest (Miroslav Bajtoš)
* server-app: improve jsdoc comments (Miroslav Bajtoš)
* server-app: middleware API improvements (Miroslav Bajtoš)
* typo of port server (wfgomes)
* Move middleware sources to `server/middleware` (Miroslav Bajtoš)
* app.middleware: verify serial exec of handlers (Miroslav Bajtoš)
* Simplify `app.defineMiddlewarePhases` (Miroslav Bajtoš)
* Make sure loopback has all properties from express (Raymond Feng)
* Implement `app.defineMiddlewarePhases` (Miroslav Bajtoš)
* Implement app.middlewareFromConfig (Miroslav Bajtoš)
* middleware/token: store the token in current ctx (Miroslav Bajtoš)
* Fix `loopback.getCurrentContext` (Miroslav Bajtoš)
* Update chai to ^1.10.0 (Miroslav Bajtoš)
* package: fix deps (Miroslav Bajtoš)
* Middleware phases - initial implementation (Miroslav Bajtoš)
* Allows ACLs/settings in model config (Raymond Feng)
* Remove context middleware per Ritchie (Rand McKinney)
* Add API doc for context middleware - see #337 (crandmck)
* Update persisted-model.js (Rand McKinney)
* rest middleware: clean up context config (Miroslav Bajtoš)
* Move `context` example to a standalone app (Miroslav Bajtoš)
* Enable the context middleware from loopback.rest (Raymond Feng)
* Add context propagation middleware (Raymond Feng)
* Changes to JSdoc comments (Rand McKinney)
* Reorder classes alphabetically in each section (Rand McKinney)
* common: coding style cleanup (Miroslav Bajtoš)
* Coding style cleanup (Gruntfile, lib) (Miroslav Bajtoš)
* Enable jscs for `lib`, fix style violations (Rob Halff)
* Add access-context.js to API doc (Rand McKinney)
* Remove doc for debug function (Rand McKinney)
* Update registry.js (Rand McKinney)
* Fix the jsdoc for User.login (Raymond Feng)
* Deleted instantiation of new Change model. This PR removes the instantiation of a new change model as models return from Change.find are already instances of Change. This solves the duplicate Id issue #649 (Berkeley Martinez)
* Expose path to the built-in favicon file (Miroslav Bajtoš)
* Add API docs for `loopback.static`. (Miroslav Bajtoš)
* Add test for `remoting.rest.supportedTypes` (Miroslav Bajtoš)
* Revert "rest handler options" (Miroslav Bajtoš)
* REST handler options. (Guilherme Cirne)
* The elapsed time in milliseconds can be 0 (less than 1 ms) (Raymond Feng)
Add a new argument to `app.middleware` allowing developers
to restrict the middleware to a list of paths or regular expresions.
Modify `app.middlewareFromConfig` to pass `config.paths` as the second
arg of `app.middleware`.
Examples:
// A string path (interpreted via path-to-regexp)
app.middleware('auth', '/admin', ldapAuth);
// A regular expression
app.middleware('initial', /^\/~(admin|root)/, rejectWith404);
// A list of scopes
app.middleware('routes', ['/api', /^\/assets/.*\.json$/], foo);
// From config
app.middlewareFromConfig(
handlerFactory,
{
phase: 'initial',
paths: ['/scope', /^\/(a|b)/]
});
The new location allows developer to use the following identifiers
when loading the middleware using the new declarative style:
app.middlewareFromConfig(
require('loopback/server/middleware/rest'),
{ phase: 'routes' });
app.middlewareFromConfig(
require('loopback/server/middleware/url-not-found'),
{ phase: 'final' });
Refactor the implementation to use the new method `phaseList.zipMerge`.
This is commit is changing the behaviour in the case when
the first new phase does not exist in the current list.
Before the change, all new phases were added just before the "routes"
phase.
After this change, new phases are added to the head of the list,
until an existing phase is encountered, at which point the regular
merge algorithm kicks in.
Example:
app.defineMiddlewarePhases(['first', 'routes', 'subapps']);
Before the change: code throws an error - 'routes' already exists.
After the change: phases are merged with the following result:
'first', 'initial', ..., 'routes', 'subapps', ...