我有基本的網絡服務器你好世界應用程序的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