Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is there a way to connect NextJS app on my phone trough local network in development like Create React App does?

enter image description here

It does not provide a local network URL like CRA.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The server is accessible on the local network, as long as the network is configured properly (and doesn’t have something like client isolation enabled). All you need to do is find out which IP address your network’s router is allocating to you. On Windows, this can be done by checking the results of ipconfig. On Linux, you can use ip addr. Then, when you want to access the app from another device, just use the IP found above followed by the port set in next.js.

For example, I have a machine whose network IP address is 192.168.1.2. On that machine, I have a Next app running on port 56381.

ready - started server on 0.0.0.0:56381, url: http://localhost:56381

I can access it on my phone by going to 192.168.1.2:56381.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading