【发布时间】:2011-11-04 16:52:04
【问题描述】:
我在 windows 上为 nodejs 提供了基本的 webserver hello world 应用程序,它可以在 localhost 上运行。但是当我从互联网上测试它时,它无法连接。我在我的网件路由器中设置了端口转发。我是否错过了让我的 nodejs 服务器对外界可见的步骤?
谢谢。
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/');
【问题讨论】:
-
如果您向我们展示您正在使用的代码会有所帮助。
-
它只是nodejs网站上的hello world web服务器。
标签: porting node.js forward-compatibility