从另一台电脑连接到localhost:3000 expressjs,nodejs [英] Connect to localhost:3000 from another computer | expressjs, nodejs

查看:98
本文介绍了从另一台电脑连接到localhost:3000 expressjs,nodejs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事一个项目,我想从另一台电脑或手机测试....,这个压缩程序连接在同一个网络上,我可以访问 http:// localhost:3000 ,btw我使用 expressjs nodejs module)像一个服务器?

解决方案

将您的应用程序配置为在 0.0.0.0 code> 127.0.0.0(本地主机)。例如:

  app.listen(3000,'0.0.0.0',function(){
console.log ('听港:'+ 3000);
});

然后从另一台电脑连接到$ code> 192.168.1.11:3000 。


I'm currently working on a project and I would like to test it from another computer or phone...., this compter is connect on the same network how i can acces to http://localhost:3000, btw I'm using expressjs (nodejs module ) like a server ?

解决方案

Configure your application to run on 0.0.0.0 instead of 127.0.0.0(localhost). For example:

app.listen(3000, '0.0.0.0', function() {
    console.log('Listening to port:  ' + 3000);
});

Then from another computer, connect to 192.168.1.11:3000.

这篇关于从另一台电脑连接到localhost:3000 expressjs,nodejs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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