服务器1.js
var data = querystring.stringify({
imageName: reqImgName
});
var options = {
host: 'localhost',
port: 4321,
path: '/image',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length
}
};
server2.js
http.createServer(function(req, res){
var reqMethod=req.method;
var request = url.parse(req.url, true);
var pathName = request.pathname;
console.log('Path name is '+pathName);
if (reqMethod=='POST' && pathName == '/image') {
//here i need my server1 data..how can i get here.
}
}).listen(4321);