Created
March 17, 2011 14:59
-
-
Save naneau/874462 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 host, http, port, server; | |
http = require('http'); | |
host = '127.0.0.1'; | |
port = 10000; | |
server = http.createServer(function(request, response) { | |
var body; | |
request.setEncoding('utf8'); | |
body = ''; | |
request.on('data', function(chunk) { | |
return body += chunk; | |
}); | |
return request.on('end', function() { | |
console.log("Ping: " + body); | |
response.statusCode = 200; | |
return response.end('PONG'); | |
}); | |
}); | |
server.listen(port); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment