fast-gateway
Advanced tools
Comparing version 1.5.0 to 1.5.1
20
index.js
@@ -6,2 +6,3 @@ const fastProxy = require('fast-proxy') | ||
const defaultProxyHandler = (req, res, url, proxy, proxyOpts) => proxy(req, res, url, proxyOpts) | ||
const DEFAULT_METHODS = require('restana/libs/methods') | ||
@@ -59,5 +60,18 @@ const gateway = (opts) => { | ||
// registering route handler | ||
const methods = route.methods || ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT', 'OPTIONS'] | ||
server.route(methods, route.prefix + route.pathRegex, handler(route, proxy, proxyHandler), null, route.middlewares) | ||
// registering route handlers | ||
const methods = route.methods || DEFAULT_METHODS | ||
methods.forEach(method => { | ||
method = method.toLowerCase() | ||
if (server[method]) { | ||
server[method]( | ||
// path | ||
route.prefix + route.pathRegex, | ||
// route handler | ||
handler(route, proxy, proxyHandler), | ||
// route middlewares | ||
route.middlewares | ||
) | ||
} | ||
}) | ||
}) | ||
@@ -64,0 +78,0 @@ |
{ | ||
"name": "fast-gateway", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "A Node.js API Gateway for the masses!", | ||
@@ -31,3 +31,3 @@ "main": "index.js", | ||
"http-cache-middleware": "^1.2.3", | ||
"restana": "^3.4.0", | ||
"restana": "^3.4.1", | ||
"stream-to-array": "^2.3.0" | ||
@@ -34,0 +34,0 @@ }, |
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
29339
552
Updatedrestana@^3.4.1