Thursday, March 12, 2015

node quick hit: url pass through

So, the jQuery in your node based app can't reach out to other sites directly because of browser's same-origin policy.

Enter "request"

Assuming you're using express (After doing "npm install request --save"):

app.get('/url/:url', function(req,res){

and my jQuery was something like


I guess it's not much worse than JSONP... anyway, this is just running in a trusted environment.

No comments:

Post a Comment