在本地网络上的其他人如何在我的机器上运行时访问我的NodeJS应用程序? [英] How could others, on a local network, access my NodeJS app while it's running on my machine?

查看:794
本文介绍了在本地网络上的其他人如何在我的机器上运行时访问我的NodeJS应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常直截了当的问题。我用NodeJS做了一个网页游戏,我可以自己成功地玩多个浏览器窗口并排打开它;但是,我想知道其他本地机器是否也可以与我一起访问和玩游戏。

I have a pretty straight-forward question. I made a web game with NodeJS, and I can successfully play it by myself with multiple browser windows open side-by-side; however, I'd like to know if it's possible for other local machines to be able to access and play the game with me too.

我天真地尝试使用这个网址: my-ip-address:8000 ,它将无效。

I naively tried using this url: my-ip-address:8000 and it won't work.

推荐答案

你的node.js服务器通常在脚本末尾确定的端口上运行。有时3000.但可以是任何东西。其他人访问的正确方法就是你说...

your node.js server is running on a port determined at the end of the script usually. Sometimes 3000. but can be anything. The correct way for others to access is as you say...

http://your.network.ip.address:port /
例如
http://192.168.0.3:3000

检查您是否有正确的端口 - 以及网络上的IP地址 - 而不是互联网IP。

check you have the correct port - and the ip address on the network - not internet ip.

否则,路由器可能阻止了端口。尝试使用8080或80来解决此问题 - 否则重新配置您的路由器。

Otherwise, maybe the ports are being blocked by your router. Try using 8080 or 80 to get around this - otherwise re-configure your router.

这篇关于在本地网络上的其他人如何在我的机器上运行时访问我的NodeJS应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆