我剛安裝節點v.0.7.4.msi在我的Win7 64想跑下面的代碼片段來測試它:爲什麼我在使用Node.js時看不到localhost上的結果?
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
但每次我跑了它在CMD的時候,它只是表明「服務器運行在http://127.0.0.1:1337/「,我無法在瀏覽器中打開」localhost:1337「以查看」Hello World「(始終處於加載階段)。有誰知道爲什麼?非常感謝。