使用本地MySQL数据库将React App展示到使用Ngrok的Internet
我是Ngrok的新手,所以请忍受我。
我有一个非常简单的React Test应用程序,它将使用Django用作服务器和本地MySQL数据库。 Django从本地数据库中拉/插入一些信息,并发送到前端。一切都很好。
我要做的就是将此本地应用程序曝光到公共互联网。我已经成功安装和配置了Ngrok,建立了隧道,并能够通过Ngrok生成的地址在另一台计算机上查看该应用程序。问题是,我只能看到与数据库无关的UI。当我使用其他计算机时,从本地数据库中拉出的所有反应数据都不可见。我的问题是,有没有一种方法可以通过NGrok使用同一应用,并从本地运行该应用程序时从本地MySQL数据库中获取相同的数据?我知道我可以创建另一个露出端口MySQL或Django的隧道(分别为3306和8000),但是如果这样做,我将如何通过Ngrok访问数据?我需要更改React代码中的任何内容吗?
先感谢您!
I am very new to ngrok, so please bear with me.
I have a very simple React test app that is using Django as a server and local MySQL database. Django pulls/inserts some info from the local database and sends to the frontend. Everything works well.
What I'm trying to do is expose this local app to public Internet. I have successfully installed and configured Ngrok, established a tunnel and was able to view the app on a different computer through the address generated by Ngrok. The problem is, I was able to see only the UI that is not related to the database. All data that React pulls from the local database, was not visible when I used a different computer. My question is, is there a way to use the same app through Ngrok and get the same data from the local MySQL database that I see when I just run the app locally? I know that I can create another tunnel that exposes the port MySQL or Django are running on (3306 and 8000 respectively) but if I do this, how would I access the data through Ngrok? Would I need to change anything in React code?
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论