【问题标题】:Node.js localhost errorNode.js 本地主机错误
【发布时间】: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

我真的……真的很想知道这是为什么…… 谢谢:)

【问题讨论】:

标签: node.js localhost port


【解决方案1】:

您在本应输入 http://localhost:8080/ 时输入了 http://localhost/8080

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-07-29
    • 2012-11-03
    • 1970-01-01
    • 2021-03-29
    • 2013-08-14
    • 2014-06-07
    • 2018-06-27
    • 2012-10-31
    相关资源
    最近更新 更多