【发布时间】:2021-11-07 01:37:37
【问题描述】:
我想为我想要制作的应用程序创建一个私有后端,但我无法连接到我的节点服务器,我现在有基本的东西,
var http = require("http");
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('<html><body><h1>Hello World</h1></body></html>');
}).listen(3000);
console.log('Server running on port 300.')
但这仅适用于 https://localhost:3000/,我该如何制作,以便如果我在单独的连接上有一台单独的计算机,我可以连接到该服务器?
我对只向所有人开放它不感兴趣,而只是对特定的客户端 IP 开放...
【问题讨论】:
-
您是否检查了端口 3000 的防火墙设置?