To all my UI devs out there, I finally had some time to rework json-proxy into a lean and meaner machine.
If you haven’t seen the proxy before, it enables a UI dev to proxy localhost URLs to a remote server.
Why do this? Say you are doing an AngularJS front end, and want to wire some data to a REST API call like
Before, you had to mock out the JSON result, run the entire server stack locally, or just cross your fingers and hope it works on the integration server.
Well, the proxy lets you transparently reroute
http://localhost/api/foo/1 from your local laptop to an integration server
http://integration-server/api/foo/1. No CORS. No JSONP. No nonsense.
With v0.1.0, the big change is the proxy now works right inside the Grunt server. Here’s an example config from the scaffold project:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
Even better, you can inject headers into proxied request. So if you remote server requires an Authorization header with an OAuth-style token, or sits behind an Enterprise SSO appliance, you can add the headers to deal with bypassing the remote server authentication.
The CLI utility is also improved. The CLI properly supports global installation.
If you install using
sudo npm install -g json-proxy, you can invoke the proxy simply as
json-proxy with whatever args you want.
CLI usage info:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25