Created
February 25, 2019 02:38
-
-
Save codenirvana/afb41744865e13d77da7be7ed2f2539c to your computer and use it in GitHub Desktop.
Simple RAW HTTP Echo Server in Node.js
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
const net = require('net'); | |
net.createServer(function (socket) { | |
socket.on('data', function (chunk) { | |
socket.write('HTTP/1.1 200 Ok\r\n'); | |
socket.write('\r\n'); | |
socket.write(chunk.toString()); | |
socket.end(); | |
}); | |
}).listen(3000); | |
// start server: node rawEcho.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment