Node.js와 마찬가지로 서버 측 자바 스크립트가 처음입니다. 내가 서버 console.log("node server");
에 요청을 보낼 때마다 나는 결과를 볼로node.js 간단한 웹 서버 라이프 사이클 요청
var http = require("http");
http.createServer(function(request, response) {
console.log("node server");
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(2424);
두 번 실행 등 글쎄, 나는 여기 아주 간단한 일을 시도하고있다. 노드 (또는 http.createServer
)가 요청을 처리하는 이유는 무엇일까요?
글쎄, 요청을 기록하십시오. 브라우저에서 서버를 호출하는 경우 파비콘 중 하나 일 가능성이 큽니다. –
@dystroy (request.path! = '/ favicon')가 참일 경우 모두 – Riki
요청을 기록하고 이와 같이 테스트하지 마십시오! –