I have added a small repo on Github that shows how to create a simple HTTP echo service.
https://github.com/toreaurstadboss/NodeJsHttpEchoServer
The server.js is script is this:
let http = require('http');
console.log('Attempting to start the Node.js echos server on port 8081..')
http.createServer().on('request', function(request, response){
request.pipe(response);
}).on('close', function(){
console.log('The Node.js echo server has been closed.')
})
.listen(8081);
console.log('Node.js echo server started on port 8081.')
This will pipe out the requesting data to the response. Test it out with this command for example in a command window:
curl -d "Hello dog" http://localhost:8081
Note - use not Powershell for this command as Powershell has aliased curl command for Invoke-WebRequest.
Rather install curl with Chocolatey for example,
choco install curl