hydra-express
Advanced tools
Comparing version 1.2.10 to 1.2.12-experimental
21
index.js
@@ -23,3 +23,4 @@ /** | ||
const ServerResponse = require('fwsp-server-response'); | ||
const hydra = require('hydra'); | ||
const ServerResponse = hydra.getServerResponse(); | ||
let serverResponse = new ServerResponse(); | ||
@@ -39,9 +40,3 @@ | ||
const jwtAuth = require('fwsp-jwt-auth'); | ||
const hydra = require('hydra'); | ||
const HTTP_OK = 200; | ||
const HTTP_UNAUTHORIZED = 401; | ||
const HTTP_NOT_FOUND = 404; | ||
const HTTP_SERVER_ERROR = 500; | ||
let app = express(); | ||
@@ -513,3 +508,3 @@ | ||
let err = new Error('Not Found'); | ||
err.status = HTTP_NOT_FOUND; | ||
err.status = ServerResponse.HTTP_NOT_FOUND; | ||
next(err); | ||
@@ -525,4 +520,4 @@ }); | ||
app.use((err, req, res, _next) => { | ||
let errCode = err.status || HTTP_SERVER_ERROR; | ||
if (err.status !== HTTP_NOT_FOUND) { | ||
let errCode = err.status || ServerResponse.HTTP_SERVER_ERROR; | ||
if (err.status !== ServerResponse.HTTP_NOT_FOUND) { | ||
this.appLogger.fatal({ | ||
@@ -590,3 +585,3 @@ event: 'error', | ||
if (!authHeader) { | ||
this.sendResponse(HTTP_UNAUTHORIZED, res, { | ||
this.sendResponse(ServerResponse.HTTP_UNAUTHORIZED, res, { | ||
result: { | ||
@@ -605,3 +600,3 @@ reason: 'Invalid token' | ||
.catch((err) => { | ||
this.sendResponse(HTTP_UNAUTHORIZED, res, { | ||
this.sendResponse(ServerResponse.HTTP_UNAUTHORIZED, res, { | ||
result: { | ||
@@ -613,3 +608,3 @@ reason: err.message | ||
} else { | ||
this.sendResponse(HTTP_UNAUTHORIZED, res, { | ||
this.sendResponse(ServerResponse.HTTP_UNAUTHORIZED, res, { | ||
result: { | ||
@@ -616,0 +611,0 @@ reason: 'Invalid token' |
{ | ||
"name": "hydra-express", | ||
"version": "1.2.10", | ||
"version": "1.2.12-experimental", | ||
"description": "A module which wraps Hydra and ExpressJS to provide an out of the box microservice which can support API routes and handlers.", | ||
@@ -45,6 +45,5 @@ "author": { | ||
"express": "4.15.2", | ||
"hydra": "1.2.10", | ||
"hydra": "1.2.12-experimental", | ||
"fwsp-jsutils": "1.0.10", | ||
"fwsp-jwt-auth": "0.0.8", | ||
"fwsp-server-response": "2.2.6", | ||
"helmet": "3.5.0", | ||
@@ -51,0 +50,0 @@ "moment": "2.18.1", |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
10
904183
843
1
+ Addedhydra@1.2.12-experimental(transitive)
- Removedfwsp-server-response@2.2.6
- Removedfwsp-server-response@2.2.6(transitive)
- Removedhydra@1.2.10(transitive)
Updatedhydra@1.2.12-experimental