Releases: BackendStack21/fast-gateway
Refactoring restana routes registration
Minor cleanup in regards to restana routes registration.
Support restana server factory
In this release we extend the gateway configuration related to restana
, basically we are allowing to overwrite the restana instantiation inside the gateway by providing a factory method.
const gateway = require('fast-gateway')
const restana = require('restana')
const serverInstance = restana({})
const server = gateway({
restana: () => serverInstance,
//...
})
The goal is to allow more complex restana initialisations such as the Elastic APM support.
Adding timeouts and proxyHandler hook
Added
Timeouts and Unavailability
We can restrict requests timeouts globally or at service level using the timeout
configuration.
You can also define endpoints specific timeout using the property timeout
of the request object, normally inside a middleware:
req.timeout = 500 // define a 500ms timeout on a custom request.
NOTE: You might want to also check https://www.npmjs.com/package/middleware-if-unless
Circuit Breakers
By using the proxyHandler
hook, developers can optionally intercept and modify the default gateway routing behavior right before the origin request is proxied to the remote service. Therefore, connecting advanced monitoring mechanisms like Circuit Breakers is rather simple.
Please see the demos/circuitbreaker.js
example for more details using the opossum
library.
Update dependencies
"dependencies": {
"fast-proxy": "^1.2.0",
...
"restana": "^3.3.3",
...
}
Updating restana and other dev deps
Merge pull request #10 from jkyberneees/update-deps updating deps
Introduce global "targetOverride" config
Intended for testing and debugging purposes, the new targetOverride
property allows to "debug" your remote gateway instance by ignoring all target
values on the config.
This property is optional and should not be set on production.
Usage:
const service = gateway({
targetOverride: 'https://yourdev.api-gateway.com'
...
routes: [...]
})
Updating deps
Updating deps:
- fast-proxy:
^1.1.3
GET /services.json
Now the gateway exposes minimal documentation about registered services at: GET /services.json
Example output:
[
{
"prefix":"/public",
"docs":{
"name":"Public Service",
"endpoint":"/swagger.json",
"type":"swagger"
}
},
{
"prefix":"/admin"
}
]
Updating deps
"restana": "^3.3.0"
Updating deps
"http-cache-middleware": "^1.2.3"