use middleware.json
This commit is contained in:
parent
a0b68ee097
commit
851d6f6b70
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"legacyExplorer": false,
|
||||
"restApiRoot": "/api",
|
||||
"host": "0.0.0.0",
|
||||
"port": 3000,
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"initial:before": {
|
||||
"loopback#favicon": {},
|
||||
"loopback#compress": {}
|
||||
},
|
||||
"initial": {
|
||||
"compression": {}
|
||||
},
|
||||
"session": {
|
||||
},
|
||||
"auth": {
|
||||
},
|
||||
"parse": {
|
||||
},
|
||||
"routes": {
|
||||
},
|
||||
"files": {
|
||||
"loopback#static": {
|
||||
"params": "$!../client"
|
||||
}
|
||||
},
|
||||
"final": {
|
||||
"loopback#urlNotFound": {}
|
||||
},
|
||||
"final:after": {
|
||||
"errorhandler": {}
|
||||
}
|
||||
}
|
|
@ -3,32 +3,9 @@ var boot = require('loopback-boot');
|
|||
|
||||
var app = module.exports = loopback();
|
||||
|
||||
// Set up the /favicon.ico
|
||||
app.use(loopback.favicon());
|
||||
|
||||
// request pre-processing middleware
|
||||
app.use(loopback.compress());
|
||||
|
||||
// -- Add your pre-processing middleware here --
|
||||
|
||||
// boot scripts mount components like REST API
|
||||
boot(app, __dirname);
|
||||
|
||||
// -- Mount static files here--
|
||||
// All static middleware should be registered at the end, as all requests
|
||||
// passing the static middleware are hitting the file system
|
||||
// Example:
|
||||
var path = require('path');
|
||||
app.use(loopback.static(path.resolve(__dirname, '../client')));
|
||||
|
||||
// Requests that get this far won't be handled
|
||||
// by any middleware. Convert them into a 404 error
|
||||
// that will be handled later down the chain.
|
||||
app.use(loopback.urlNotFound());
|
||||
|
||||
// The ultimate error handler.
|
||||
app.use(loopback.errorHandler());
|
||||
|
||||
app.start = function() {
|
||||
// start the web server
|
||||
return app.listen(function() {
|
||||
|
|
Loading…
Reference in New Issue