Open jamesplease opened 7 years ago
Another option would be to allow url
to be a function, so that you could do:
proxy({
url() {
return getDaUrl();
}
})
The motivation behind this request is that I need to include round robin behavior into the proxy.
Apologies @jamesplease, you've probably long since moved on. Think my notification preferences were preventing me from finding out about issues. Would be open to PR however.
I'm interested in using
express-request-proxy
to dynamically proxy endpoints. I know this isn't a documented use case, but it's not so hard to do:The overhead of this extra function call shouldn't be a problem, but I'm a little hesitant to be creating the in-scope functions (such as this one) for each request when that could be avoided.
Would you be open to a PR that would pull those outside of the main export function so that they're shared among all proxies? It would require a slight modification to their signature to accept an
options
argument. This way, there's less overhead to generating lots and lots (and lots) of proxies.It'd look something like:
Thanks for reading!