Created
October 29, 2012 21:55
-
-
Save mark-adams/3976795 to your computer and use it in GitHub Desktop.
SimpleLTC API Echo Server
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
// API Echo Server | |
// Developed by Mark Adams <[email protected]> | |
var net = require('net'); | |
var server = net.createServer(function(c){ | |
c.on('data', function(buffer){ | |
c.write('HTTP/1.1 200 OK\n\r\n'); | |
c.write(buffer.toString()); | |
c.end(); | |
console.log('%s - Request received from %s', new Date(), c.remoteAddress); | |
console.log('Raw request contents:'); | |
process.stdout.write(buffer.toString()) | |
}); | |
}); | |
server.listen(80, function() { | |
console.log('Server bind successful! Awaiting connections...'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment