Consume api AdonisJS on the local network


#1

I have an api with AdonisJS on my pc running on port 3333.
I also have an application in ReactJS, which consumes my api adonis, running on port 3000.
When I run my application ReactJS it provides the ip of the PC to access in the local network and to be able to test of the Smathphone or another PC.

The problem is that when I go to consume the application by the smartphone my API does not respond to the application in ReactJS.

I have already configured the CORS of adonis to respond to the ReactJS application by passing the string with the oigem (my ReactJS application) and the string ‘*’ (releasing any source consuming the api).


#2

What do you have your HOST set as in the .env file? You could try HOST=0.0.0.0


#3

:wave:,

You could try using ngrok.

Install it via npm i ngrok

Then

ngrok http 3333