Make sure your express application responds correctly when outgoing http requests are failing
When your express application is calling failing resources, mount this middleware to ensure it will respond with a proper
502 Bad Gateway response when needed.
$ npm install anubis --save
This is a tiny express app that will do nothing but proxy another resource. In case the call fails with a 5xx error, anubis makes sure the correct
502 status code is returned.
var express = ;var rp = ;var anubis = ;var app = ;app;// always make sure to mount anubis **after** all routes that call// external resources// pass a function that transforms the Error into a status codeapp;app;
MIT © Frederik Ring