B. Satter B. Satter - 1 year ago 74
Node.js Question

Node-HTTP-Proxy error

I am trying to implement a node http proxy for the first time with my simple twitter tweeter. I have never used this before and tried following the docs (https://github.com/nodejitsu/node-http-proxy) with no luck. Can anyone point me in the right direction? Also, is it okay to run this locally on a mac? Thanks

var express = require('express');
var app = express();
var port = 8300;
var twitter = require('twitter');
var twit = new twitter({ keys and stuff })

var http = require('http'),
httpProxy = require('http-proxy');

twit.post('statuses/update', {status: "Hello world!"}
//this works


// Create your target server--- WHat exactly does this mean??

http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2));


Answer Source

You should not use this lib for proxing you request. This lib is for make your own proxy server. Look at example how to use proxy with twitter lib