【发布时间】:2016-09-22 18:12:45
【问题描述】:
我刚刚开始探索 node.js。在我的 Windows 服务器上安装了 msi 文件。我下面的代码在命令窗口中返回了我的预期输出
var http = require("http");
http.createServer(function (request, response) {
// Send the HTTP header
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'});
// Send the response body as "Hello World"
response.end('Hello World\n');
}).listen(8081);
// Console will print the message
console.log('Server running at `http://127.0.0.1:8081/`');
但是当我在浏览器中输入http://127.0.0.1:8081/ 时,我没有得到任何输出。当我看到控制台时,我得到以下错误
Failed to load resource: the server responded with a status of 403 (Forbidden)
我错了什么以及如何解决?我正在关注这个link
【问题讨论】:
标签: node.js