hydra-express
Advanced tools
Comparing version 1.4.20-experimental to 1.4.21-experimental
71
index.js
@@ -436,44 +436,41 @@ /** | ||
this.server.listen(this.config.hydra.servicePort, () => { | ||
Promise.resolve(this.registerRoutesCallback && this.registerRoutesCallback()) | ||
.then(routesRegistered => this._postRouteSetup()); | ||
}); | ||
} | ||
this.registerRoutesCallback && this.registerRoutesCallback(); | ||
_postRouteSetup() { | ||
app.use('/*', (req, res) => { | ||
res.sendFile(path.resolve(this.config.appPath + '/index.html')); | ||
}); | ||
app.use('/*', (req, res) => { | ||
res.sendFile(path.resolve(this.config.appPath + '/index.html')); | ||
}); | ||
/** | ||
* Post middleware init. Make sure to do this last. | ||
*/ | ||
/** | ||
* Post middleware init. Make sure to do this last. | ||
*/ | ||
/** | ||
* @param {object} req - express request object | ||
* @param {object} res - express response object | ||
* @param {function} next - express next handler | ||
*/ | ||
app.use((req, res, next) => { | ||
let err = new Error('Not Found'); | ||
err.status = ServerResponse.HTTP_NOT_FOUND; | ||
next(err); | ||
}); | ||
/** | ||
* @param {object} req - express request object | ||
* @param {object} res - express response object | ||
* @param {function} next - express next handler | ||
*/ | ||
app.use((req, res, next) => { | ||
let err = new Error('Not Found'); | ||
err.status = ServerResponse.HTTP_NOT_FOUND; | ||
next(err); | ||
}); | ||
/** | ||
* @param {object} err - express err object | ||
* @param {object} req - express request object | ||
* @param {object} res - express response object | ||
* @param {function} _next - express next handler | ||
*/ | ||
app.use((err, req, res, _next) => { | ||
let errCode = err.status || ServerResponse.HTTP_SERVER_ERROR; | ||
if (err.status !== ServerResponse.HTTP_NOT_FOUND) { | ||
this.appLogger.fatal({ | ||
event: 'error', | ||
error: err.name, | ||
stack: err.stack | ||
/** | ||
* @param {object} err - express err object | ||
* @param {object} req - express request object | ||
* @param {object} res - express response object | ||
* @param {function} _next - express next handler | ||
*/ | ||
app.use((err, req, res, _next) => { | ||
let errCode = err.status || ServerResponse.HTTP_SERVER_ERROR; | ||
if (err.status !== ServerResponse.HTTP_NOT_FOUND) { | ||
this.appLogger.fatal({ | ||
event: 'error', | ||
error: err.name, | ||
stack: err.stack | ||
}); | ||
} | ||
res.status(errCode).json({ | ||
code: errCode | ||
}); | ||
} | ||
res.status(errCode).json({ | ||
code: errCode | ||
}); | ||
@@ -480,0 +477,0 @@ }); |
{ | ||
"name": "hydra-express", | ||
"version": "1.4.20-experimental", | ||
"version": "1.4.21-experimental", | ||
"description": "A module which wraps Hydra and ExpressJS to provide an out of the box microservice which can support API routes and handlers.", | ||
@@ -31,3 +31,3 @@ "author": { | ||
"helmet": "3.6.0", | ||
"hydra": "1.4.18", | ||
"hydra": "1.4.19-experimental", | ||
"moment": "2.18.1", | ||
@@ -34,0 +34,0 @@ "response-time": "2.3.2" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
900669
746
+ Addedhydra@1.4.19-experimental(transitive)
- Removedhydra@1.4.18(transitive)
Updatedhydra@1.4.19-experimental