Node.js server “404 not found” message to 404.html page

前端 未结 5 1689
南旧
南旧 2021-01-04 16:50

Im working with node.js and I would like to know how to display a 404.html instead of a \"404 Not Found\" message.

This is my server.js:

var http = r         


        
5条回答
  •  北荒
    北荒 (楼主)
    2021-01-04 17:15

    Do just for the 200... Read a file 404.html and write it to the response, just set the code 404 in writeHead.

提交回复
热议问题