Created
May 27, 2016 14:30
-
-
Save marisusis/cd75f8f94b5c5fe328cfc6ffaea5ddde to your computer and use it in GitHub Desktop.
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 characters
var log = require('util').log; | |
var http = require('http'); | |
var express = require('express'); | |
var app = express(); | |
var server = http.createServer(app); | |
var path = require('path'); | |
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; | |
//implement http config | |
var port = 9500; | |
app.set('port', port); | |
app.get('/get', function(req, res) { | |
log(req.query.url); | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET',req.query.url); | |
xhr.onload = function(e) { | |
res.send(xhr.responseText); | |
} | |
xhr.send(); | |
}); | |
server.listen(port, function(e) { | |
log("http server listening on :9500"); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment