从本地主机到 Web 的 Node.js 应用程序 [英] Node.js app from localhost to the web

查看:24
本文介绍了从本地主机到 Web 的 Node.js 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Web 开发新手,因此需要在此过程中得到指导.目前有一个节点应用

New to web development so need to be guided through this process. Currently have an node app

http://localhost:8080/api/allinfo?unit_number=&street_number=&street_name=kent&street_type=st&suburb=&state=&postcode=

当输入参数时,它连接到我的具有地址表的 SQL 服务器数据库

When put in with parameters it connects to my SQL server DB which has table of addresses

var dbConfig = {
    user: "A",
    password: "XXX",
    server: "local",
    database: "dB"
};

我希望能够将 url 提供给其他人,以便他们可以在自己的计算机上使用它.为了实现这一点,我需要执行哪些流程?

I'd like to be able to give the url to others so they can use this from their own computers. What is the process I need to do in order for that to happen?

推荐答案

最好的选择是使用隧道软件.因为您知道 localhost 无法从您的工作站访问.您可以手动为 windows 设置 iptables 和重定向以及防火墙设置,尽管上述操作非常乏味.

The best option is to use a tunneling software. Because you know localhost is not accessible from your work station. You could manually set iptables and redirection and fire wall settings for windows, though the aforementioned is quite tedious.

第一个选项是:Localtunnel, Localtunnel 将为您分配一个唯一的可公开访问的 url,它将代理所有请求到您本地运行的网络服务器.

The first option is: Localtunnel, Localtunnel will assign you a unique publicly accessible url that will proxy all requests to your locally running webserver.

第二,Ngrok:将 NAT 或防火墙后面的本地服务器暴露给互联网.

Second, Ngrok : expose a local server behind a NAT or firewall to the internet.

第三,PageKite:是一个基于 Python 的基于动态隧道的反向代理",适用于 Windows、Mac OS X、Linux,甚至 Android 设备!它与 ngrok 非常相似,但已经存在了相当长的时间,并且似乎经过了更多的实战测试以用于更大的用途.他们甚至让它与 Minecraft 协议一起工作,允许人们在他们的本地机器上运行 Minecraft 服务器.

Third, PageKite: is a Python-based "dynamic tunnel based reverse proxy" that works on Windows, Mac OS X, Linux, and even Android devices! It is very similar to ngrok but has been around for quite a bit longer and appears quite a bit more battle-tested for a larger set of uses. They’ve even got it working with the Minecraft protocol to allow people to run a Minecraft server on their local machine.

四、转发:在 forwardhq.com 上注册一个帐户.注册时,您提供要在服务上使用的初始 URL(类似于 PageKite).我设置我的转发到 patcat.fwd.wf.确保您的计算机上安装了 Ruby 和 Rubygems!

Fourth, Forward : Sign up for an account at forwardhq.com. When signing up, you provide the initial URL that you’d like to use on the service (similar to PageKite). I set mine up to forward to patcat.fwd.wf. Make sure you’ve got Ruby and Rubygems installed on your computer!

第五,ProxyLocal:ProxyLocal 似乎是一个运行在 Ruby 上的小规模隧道服务.它是完全免费的,对于学生和那些很少需要隧道服务的人来说可能是一个不错的预算选择.

Fifth, ProxyLocal : ProxyLocal appears to be a much smaller-scale tunneling service that runs on Ruby. It is completely free and could be a good budget option for students and those needing a tunneling service very infrequently.

更新:ProxyLocal 已关闭,并建议使用 ngrok 作为替代服务.

Update: ProxyLocal has since shut down and is recommending ngrok as the replacement service.

第六,BrowserStack:BrowserStack 提供自动截图和虚拟机,以针对一系列设备和浏览器测试您的网站.如果您想访问 localhost 的原因是为了测试,您可能会对 BrowserStack 感兴趣.

Sixth, BrowserStack: BrowserStack provides provides automated screenshots and virtual machines to test your website against a range of devices and browsers. If the reason you’re wanting to access localhost is for testing, BrowserStack might be of interest to you.

最后,burrow.io:通过以下方式公开您的本地开发站点可共享的网址

And lastly, burrow.io: Expose your local dev site through a shareable URL

这篇关于从本地主机到 Web 的 Node.js 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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