Comparing version 0.2.0 to 0.3.0
@@ -13,3 +13,3 @@ /** | ||
for (let i = 0; i < pipeline.length; i += 1) { | ||
container = await pipeline[i](container); // eslint-disable-line no-await-in-loop | ||
container = await pipeline[i](container, req); // eslint-disable-line no-await-in-loop | ||
} | ||
@@ -16,0 +16,0 @@ res.send(container.body); |
@@ -10,2 +10,3 @@ /** | ||
const filter = require('./filter'); | ||
const forwardedhost = require('./forwardedhost'); | ||
const waitfor = require('./waitfor'); | ||
@@ -16,3 +17,4 @@ | ||
filter, | ||
forwardedhost, | ||
waitfor, | ||
}; |
{ | ||
"name": "nodegate", | ||
"description": "API gateway made simple, fast and easy to configure.", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"author": "Julien Martin <martin.julien82@gmail.com>", | ||
@@ -24,3 +24,3 @@ "license": "MIT", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-import": "^2.15.0", | ||
"eslint-plugin-import": "^2.17.2", | ||
"jest": "^24.7.1", | ||
@@ -27,0 +27,0 @@ "nock": "^10.0.6", |
@@ -273,2 +273,3 @@ ![nodegate](assets/images/logo-readme.png) | ||
- [filter(properties)](#filterproperties) | ||
- [forwardedhost()](#forwardedhost) | ||
- [waitfor(method, url, test)](#waitformethod-url-test) | ||
@@ -315,2 +316,15 @@ | ||
#### forwardedhost() | ||
Add the the container headers the property `X-Forwarded-Host` with the value of the original request | ||
header `host`. | ||
_Example_ | ||
```js | ||
const pipeline = [ | ||
forwardedhost(), | ||
]; | ||
``` | ||
#### waitfor(method, url, test) | ||
@@ -317,0 +331,0 @@ |
@@ -31,7 +31,13 @@ /** | ||
const route = expressApp => (settings) => { | ||
expressApp[settings.method.toLowerCase()]( | ||
settings.path, | ||
executor(settings.pipeline), | ||
); | ||
const addRoute = expressApp => (routes) => { | ||
let routesToAdd = routes; | ||
if (!Array.isArray(routes)) { | ||
routesToAdd = [routes]; | ||
} | ||
routesToAdd.forEach((route) => { | ||
expressApp[route.method.toLowerCase()]( | ||
route.path, | ||
executor(route.pipeline), | ||
); | ||
}); | ||
}; | ||
@@ -48,3 +54,3 @@ | ||
app.route = route(expressApp); | ||
app.route = addRoute(expressApp); | ||
@@ -51,0 +57,0 @@ app.listen = expressApp.listen; |
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
22623
15
316
387