New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.63-experimental to 1.5.0-experimental

82

index.js

@@ -8,2 +8,4 @@ /**

const debug = require('debug')('hydra-express');
const Promise = require('bluebird');

@@ -181,4 +183,3 @@ Promise.config({

return this.start(resolve, reject)
.catch((err) => this.log('error', err.toString()));
return this.start(resolve, reject);
}

@@ -191,8 +192,16 @@ });

* @summary Shutdown hydra-express safely.
* @return {undefined}
* @return {object} Promise - promise resolving to hydraexpress ready or failure
*/
_shutdown() {
this.server.close(() => {
this.log('error', 'Service is shutting down.');
hydra.shutdown();
return new Promise((resolve, reject) => {
this.server.close(() => {
this.log('error', 'Service is shutting down.');
hydra.shutdown()
.then((result) => {
resolve(result);
})
.catch((err) => {
reject(err);
});
});
});

@@ -247,2 +256,4 @@ }

log(type, message) {
let msg = (typeof message === 'object') ? Utils.safeJSONStringify(message) : message;
debug(`${type} ${msg}`);
let suppressLogEmit = true;

@@ -253,3 +264,3 @@ switch (type) {

event: type,
message
message: msg
});

@@ -261,3 +272,3 @@ hydra.sendToHealthLog('fatal', message, suppressLogEmit);

event: type,
message
message: msg
});

@@ -269,3 +280,3 @@ hydra.sendToHealthLog('fatal', message, suppressLogEmit);

event: type,
message
message: msg
});

@@ -276,3 +287,3 @@ break;

event: type,
message
message: msg
});

@@ -306,7 +317,8 @@ break;

})
.then((..._results) => {
return Promise.delay(2000);
})
.then(() => Promise.delay(2000))
.then(() => resolve(serviceInfo))
.catch((err) => this.log('error', err.toString()));
.catch((err) => {
this.log('error', {err});
process.emit('cleanup');
});
}

@@ -340,13 +352,10 @@

process.on('cleanup', () => {
this._shutdown();
process.exit(0);
this._shutdown()
.then(() => {
process.exit(1);
})
.catch((_err) => {
process.exit(1);
});
});
process.on('SIGTERM', () => {
this.log('fatal', 'Received SIGTERM');
process.emit('cleanup');
});
process.on('SIGINT', () => {
this.log('fatal', 'Received SIGINT');
process.emit('cleanup');
});
process.on('unhandledRejection', (reason, _p) => {

@@ -369,2 +378,10 @@ this.log('fatal', Utils.safeJSONStringify(reason));

});
process.on('SIGTERM', () => {
this.log('fatal', 'Received SIGTERM');
process.emit('cleanup');
});
process.on('SIGINT', () => {
this.log('fatal', 'Received SIGINT');
process.emit('cleanup');
});

@@ -486,14 +503,11 @@ /**

// but with an undefined route property
if (routeInfo === undefined) {
return;
if (routeInfo) {
Object.keys(routeInfo.methods).forEach((method) => {
routesList.push(`[${method}]${routePath}${routeInfo.path}`);
});
}
Object.keys(routeInfo.methods).forEach((method) => {
routesList.push(`[${method}]${routePath}${routeInfo.path}`);
});
});
app.use(routePath, routes[routePath]);
});
if (routesList.length > 0) {
hydra.registerRoutes(routesList);
}
hydra.registerRoutes(routesList);
}

@@ -580,6 +594,6 @@

* @summary Shutdown hydra-express safely.
* @return {undefined}
* @return {object} Promise - promise resolving to hydraexpress ready or failure
*/
shutdown() {
super._shutdown();
return super._shutdown();
}

@@ -586,0 +600,0 @@

{
"name": "hydra-express",
"version": "1.4.63-experimental",
"version": "1.5.0-experimental",
"description": "A module which wraps Hydra and ExpressJS to provide an out of the box microservice which can support API routes and handlers.",

@@ -28,5 +28,6 @@ "author": {

"cors": "2.8.3",
"debug": "2.6.8",
"express": "4.15.3",
"hydra": "1.4.63-experimental",
"helmet": "3.6.0",
"hydra": "1.5.0-experimental",
"moment": "2.18.1",

@@ -33,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