2017-10-03 8 views
0

사용자 지정 오류 메시지 - "https://www.npmjs.com/package/http-server" 내가 아닌 내가 브라우저 MSG 얻기보다, 디렉토리에 파일을 존재 입력하면 :Node.js를 HTTP 서버 I는 Node.js를 HTTP 서버 시작

This localhost page can’t be found 

No webpage was found for the web address: http://localhost:8080/foo 
Search Google for localhost 8080 foo 
HTTP ERROR 404 

내 질문 : 어떻게 든이 오류 메시지를 사용자 정의 할 수 있습니까?

답변

0

해당 파일

명령 줄

# http-server ./public/

내용의 ./public/404.html

에 표시 할 내용을 당신의 public 디렉토리에 404.html 파일을 만들어 넣어
<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <title>404</title> 
</head> 
<body> 
<p>My custom 404 message</p> 
</body> 
</html> 
+0

감사합니다. 잘 작동합니다! – Peter