This post will show how to create a simple HTTP proxy using NodeJS and Express. This simple proxy dispatches the caller's request to the target server only if the called endpoint is allowed or whitelisted. In the code below to whitelist an endpoint, it has to be written in the whitelist array. The whitelist array accepts Express URL patterns documented here http://expressjs.com/api.html#app.use
These 20 lines of code took me about 4 hours to put together, so I thought I save the hassle for whoever comes after me.


No comments:
Post a Comment