0

Background

I am building a site using angularjs and want to make sure that its displaying properly on my phone. I'm aware of the Google Chrome emulator but would like to show people it directly on the phone.

Node.JS

I'm using http-server . to run a server at the base of my app. This was the quickest and easiest way of getting a server for local testing.

I have tried going onto the same network via wifi on my phone and then trying to get to localhost:8080 but it just gives me a "this web page is not available" error

Question

My question is, is there a way to get my web app on my phone with http-server . or do I need to set up a proper web-server? I thought maybe it would just be simple to get it on any device attached to the same network.

2
  • 1
    Instead of localhost, try with the ip address of the machine in which app is running. Sep 14, 2015 at 12:22
  • @MohitPandey you were correct, thanks. if you put up an answer I will accept it, mention that it has to be the device ip not your public ip.
    – Joe Lloyd
    Sep 14, 2015 at 12:33

4 Answers 4

3

Since our application(server) and devices(in which you want to access the application) running on same network.

You can access this with the help of IP address.

Let say, your app is running on

192.168.1.1:3000 

So you can access it as localhost:3000 on local machine.

And as 192.168.1.1:3000 on devices which is using the same network.

0

any device can access to server. Use ip in device not use localhost

0

Use ngrok https://ngrok.com/ , ngrok expose your localhost behind a NAT or firewall to the internet , easy to use , after install just type on command line ;

ngrok 7070

then it gives you a link like ; 3g87g9g.ngrok.com

0

Use ifconfig utility if you are in linux or use any other tool to get the ip address of your phone (Web server), for example 192.168.1.10 is IP address of the phone.

You can access the web page from any other device in the network by going to 192.168.1.10:8080 in the browser.

Note that 8080 is the port to your server application, you select the port from node.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.