Last active
August 29, 2015 14:16
-
-
Save d1egoaz/ccbba154a39fad70e647 to your computer and use it in GitHub Desktop.
Revisions
-
d1egoaz revised this gist
Mar 4, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,5 +22,5 @@ app.get('/proxy2/:token?', function (req, res) { app.listen(9042); // test // curl http://localhost:9042/proxy/testtoken Res: HTTP 200, {"name":"d1egoaz"} // curl http://localhost:9042/proxy2/testtoken Res: HTTP 400, Error 404: Not found proxy2 -
d1egoaz created this gist
Mar 4, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ var express = require('express'); var request = require('request'); var app = express(); app.all('*', function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); next(); }); app.get('/proxy/:token?', function (req, res) { var j={"name":"d1egoaz"}; res.json(j); }); app.get('/proxy2/:token?', function (req, res) { res.statusCode = 404; return res.send('Error 404: Not found proxy2'); }); app.listen(9042); // test // curl http://localhost:9042/proxy/testtoken // curl -v http://localhost:9042/proxy2/testtoken