我有基本的网络服务器你好世界应用程序的nodejs在Windows上,它在localhost上工作。但是,当我从互联网上测试它不能连接。我在我的netgear路由器中设置了端口转发。我在这里错过了一个步骤,让我的nodejs服务器对外界可见吗?Node.JS不工作在互联网上
谢谢。
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/');
如果您向我们展示您正在使用的代码,这将有所帮助。 – AppleGrew
这只是nodejs网站上的hello world web服务器。 – BRampersad