Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hydra-express

Package Overview
Dependencies
Maintainers
1
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hydra-express - npm Package Compare versions

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"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc