我在 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/');