Created
June 27, 2012 11:49
-
-
Save yosefd/3003574 to your computer and use it in GitHub Desktop.
http over named pipe sample
This file contains 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 http = require('http'); | |
var port = '\\\\.\\pipe\\nameofthepipe'; | |
http.createServer(function (req, res) { | |
console.info('request received'); | |
res.end('gotyou'); | |
}).listen(port); | |
console.info('listening on:', port); | |
var opt = { | |
host: 'localhost', | |
port: port, | |
method: 'GET' | |
} | |
var req = http.request(opt, function(res) { | |
console.info('STATUS:', res.statusCode); | |
res.on('data', function(chunk) { | |
console.info('BODY:', chunk.toString()); | |
}); | |
}); | |
req.on('error', function(e) { | |
console.error('request failed:', e); | |
}); | |
req.end(); |
so this no longer works with Node 4? If it did, it would be a life saver on Azure.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On 0.6.19 the output:
on 0.8.0 the output: