android - 建立 Node.Js 本地服务器(localhost : 8888) on WiFi though WiFi Router (Passing it through LAN to WiFi Router)?

标签 android node.js networking server router

我目前正在使用我的 mongodb 服务器以及正在运行的 Nodejs 服务器测试我的 Android 应用程序。我希望服务器可以像内联网一样通过 WiFi 访问,以便手机上的应用程序可以访问本地服务器。此外,我需要测试当连接超过 1 个设备时我的服务器如何处理?

最佳答案

如果您的移动设备和 mac/linux 设备(运行 Node 服务器)位于同一网络上,
前往终端并输入 ifconfig,在其下找到 en0 或 en1 并检查 inet 值。
类似于 192.168.x.y

现在,假设您已在防火墙上允许传入连接,并且您的 Node 服务器在端口 8888 上可用。
您应该能够在移动设备的浏览器上通过 http://192.168.x.y:8888 访问 Node 服务器。

您还可以使用 ngrock 等工具。但他们创建了一条公共(public)隧道,在我看来这不是最好的选择。

关于android - 建立 Node.Js 本地服务器(localhost : 8888) on WiFi though WiFi Router (Passing it through LAN to WiFi Router)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44685044/

相关文章:

android - 在 Gradle 中删除带有模式的目录

Android - 如何经常更新小部件但仅在它可见时?

android - Google Drive 的 App Data 文件夹的限制是多少?

javascript - Node.JS 回调关闭 websocket

node.js - 如何在 node.js 中克隆私有(private) git 存储库

linux - 如何在 "indirect"ssh 连接中传输文件?

android - Broadcast Receiver问题,注册一个Broadcast Receiver

javascript - 如何在 angular5 html 文件中显示以下对象?

Java File.exists 和其他文件操作为现有文件返回错误结果(网络、macosx)

windows - WSAGetLastError() 只是 GetLastError() 的别名吗?