4

I am working on ionic app. It has a login feature. Now I am running the whole backend logic in my local computer. Is there a way to run my app on the device and connect that from the device to local server?

2 Answers 2

2

Connecting Ionic App to a Local Server

1. Setup a Local Server

Obtain the IP of your Computer (Local Server) which would probably be of the form, 192.168.x.x or 10.x.x.x or 172.x.x.x

On Windows, the command is: ipconfig

On macOS, the command is: ifconfig

2. Connect you Device to the same Wifi Network

3. Code changes

In you code, make all network calls (HTTP requests) to the IP obtained by the previous two steps.

4. Run the App

Use, ionic cordova run to run the application on your Device.

5. If you still have questions, come here and comment. ;)

0

Ya, It's Possible.

Step 1

Run your backend with a port (your pc IP),

step 2

Connect ur phone and pc with the same network

Step 3

Connect ur phone to ur pc

step 4

Check whether ur phone enabled USB Debugging mode. If not means please on it

step 5

Then run in treminal ionic cordova run android -c -l

5
  • How can I run my backend with aport my pc IP? I am using nodejs expressjs.
    – null
    Commented Jun 6, 2018 at 19:32
  • Run your back-end code in your IP then connect the phone and your pc with the same network. you can run the app Commented Jun 7, 2018 at 8:27
  • Run your backend code in your IP? How can I use my ip in app.listen(3000)? It only accepts port as you can see.
    – null
    Commented Jun 7, 2018 at 12:59
  • you are using node js means it automatically get ur IP. And run its running also Ip with port Commented Jun 8, 2018 at 4:08
  • "And run its running also Ip with port" I am not sure what do you mean about that? I am simply using same app.listen(3000) and do not use any ip with it but when I send any request using such as http://10.0.0.63:3000/ then I am not receiving any response on the server.
    – null
    Commented Jun 10, 2018 at 2:13

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.