var http = require("http");
function onRequest(request, response) {
console.log("Request received.");
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}
http.createServer(onRequest).listen(8888);
console.log("Server has started.");
这会根据我的Chrome浏览器的请求写入控制台:
收到请求 收到请求
两次?为什么呢?
答案 0 :(得分:7)
这是您的浏览器要求favicon.ico