Move middleware sources to `server/middleware`
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' });
This commit is contained in:
parent
4474f8b029
commit
7fc66a182e
|
@ -36,6 +36,9 @@ module.exports = function(grunt) {
|
|||
common: {
|
||||
src: ['common/**/*.js']
|
||||
},
|
||||
server: {
|
||||
src: ['server/**/*.js']
|
||||
}
|
||||
// TODO tests don't pass yet
|
||||
// test: {
|
||||
// src: ['test/**/*.js']
|
||||
|
@ -44,7 +47,8 @@ module.exports = function(grunt) {
|
|||
jscs: {
|
||||
gruntfile: 'Gruntfile.js',
|
||||
lib: ['lib/**/*.js'],
|
||||
common: ['common/**/*.js']
|
||||
common: ['common/**/*.js'],
|
||||
server: ['server/**/*.js']
|
||||
// TODO(bajtos) - test/**/*.js
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -120,13 +120,16 @@ if (loopback.isServer) {
|
|||
|
||||
if (loopback.isServer) {
|
||||
fs
|
||||
.readdirSync(path.join(__dirname, 'middleware'))
|
||||
.readdirSync(path.join(__dirname, '..', 'server', 'middleware'))
|
||||
.filter(function(file) {
|
||||
return file.match(/\.js$/);
|
||||
})
|
||||
.forEach(function(m) {
|
||||
loopback[m.replace(/\.js$/, '')] = require('./middleware/' + m);
|
||||
loopback[m.replace(/\.js$/, '')] = require('../server/middleware/' + m);
|
||||
});
|
||||
|
||||
loopback.urlNotFound = loopback['url-not-found'];
|
||||
delete loopback['url-not-found'];
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var loopback = require('../loopback');
|
||||
var loopback = require('../../lib/loopback');
|
||||
var juggler = require('loopback-datasource-juggler');
|
||||
var remoting = require('strong-remoting');
|
||||
var cls = require('continuation-local-storage');
|
|
@ -2,7 +2,7 @@
|
|||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var loopback = require('../loopback');
|
||||
var loopback = require('../../lib/loopback');
|
||||
var async = require('async');
|
||||
|
||||
/*!
|
|
@ -2,7 +2,7 @@
|
|||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var loopback = require('../loopback');
|
||||
var loopback = require('../../lib/loopback');
|
||||
var assert = require('assert');
|
||||
|
||||
/*!
|
Loading…
Reference in New Issue