我正在運行一個程序來驗證.html
文件(index.html
),然後在Web瀏覽器上運行該程序。 (localhost:port/index.html)
。在Web瀏覽器中執行.HTML - 節點js
我的程序明白我要求正確的文件,但我不能在網絡瀏覽器中執行.html
文件(只是試圖顯示日期)。
我一直在網上尋找參考,但也許我不是在正確的方向看,或者我只是俯瞰一些東西。
此外response.end不會打印到網絡瀏覽器上,即使其他功能與response.end它完美地工作。
function doHTML(http_request, response)
{
// Read the requested file content from file system
fs.readFile('MYHTML/' + http_request, function (err, data) {
console.log('Hey youre in the HTML function');
response.end('Hey you got it working');
});
}