【发布时间】:2017-04-17 05:39:39
【问题描述】:
我是 node.js 的新手,我无法制作一个简单的服务器,我真的不知道为什么,但是当我打开 localhost/'port' 时,页面只是......没有收费。 这是代码。
var http = require('http');
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
server.listen(8080);
console.log("Server running at http://127.0.0.1:8000/");
在控制台我有这个消息 console message
但是在浏览器中我有这个 browser
我真的……真的很想知道这是为什么…… 谢谢:)
【问题讨论】:
-
检查你的http请求应该是这样localhost:8000你通过localhost/8080
-
请试试这个localhost:8000
-
哦...谢谢..哈哈哈