var http = require('http'); var server = http.createServer(function (request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.end("Hello World\n"); }); server.listen(8000); console.log("Server running at http://127.0.0.1:8000/");
I ran the following curl commands:
curl "http://127.0.0.1:8000/" Hello World // space is not encoded curl "http://127.0.0.1:8000/xy" curl: (52) Empty reply from server curl "http://127.0.0.1:8000/x" Hello World // space is encoded curl "http://127.0.0.1:8000/x%20y" Hello World
Could you explain why I get curl?
In this case, I want to send 500 back. Can I do it?
source share