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.19 to 1.4.20-experimental

71

index.js

@@ -436,41 +436,44 @@ /**

this.server.listen(this.config.hydra.servicePort, () => {
this.registerRoutesCallback && this.registerRoutesCallback();
Promise.resolve(this.registerRoutesCallback && this.registerRoutesCallback())
.then(routesRegistered => this._postRouteSetup());
});
}
app.use('/*', (req, res) => {
res.sendFile(path.resolve(this.config.appPath + '/index.html'));
});
_postRouteSetup() {
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
});
}
res.status(errCode).json({
code: errCode
/**
* @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
});

@@ -477,0 +480,0 @@ });

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

@@ -5,0 +5,0 @@ "author": {

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