我正在尝试使用我的简单twitter tweeter首次实现节点http代理。我之前从未使用过这个,并试着跟着文档(https://github.com/nodejitsu/node-http-proxy)没有运气。谁能指出我正确的方向?另外,可以在Mac上本地运行吗?谢谢
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
httpProxy.createProxyServer({target:'http://localhost:3000'}).listen(3000);
// 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));
res.end();
}).listen(3000);