Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as JavaScript by Navy ( 15 years ago )
http.createServer(function serv(request, response) {
 request.setEncoding("utf8");
 request.content = ''
  
 if(request.method === "POST") {

        var data = "";
        var response_data ="";

        response.writeHead(200, {"Content-Type":"text/plain"});
        
        request.on("data", function(chunk) {
            data += chunk;
        });
        
        request.on("end", function() {
         try {
             data = JSON.parse(data);
   response_data = http_back(data);
         } catch (e) {
   console.log("HTTP-request "+e)
   }
            response.write("Hallo");
            response.write(JSON.stringify(response_data));
        });
        response.end();
    }
}).listen(8000);

 

Revise this Paste

Your Name: Code Language: