I am trying to create an http server that reads only POST requests and returns the body of the request in upper case. This is my code:
http=require("http");
fs=require("fs");
http.createServer(function(req,res){
 if(req.method=="POST")
 {
 var body = '';
 req.on('data', function (data) {body += data.toString();});
 body=body.toUpperCase()
 res.end(body);
 }
 else
 {
 res.end("Not a POST request.");
 }
 }).listen(process.argv[2]);
When I run this from the command prompt (specifying a port number), I get the following error:
Error connecting to http://localhost:61777: read ECONNRESET
How do I get this work?
 
    