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.