I am working on my app, and while I use yarn run dev
I cannot make API calls to the API routes defined by me. The app runs on port 3000, but the server on 3500. If I hardcode the "3500" into the API call, it works, like this:
fetch('http://localhost:3500/api/config').then(r => r.json());
if I leave it like this it doesn't work:
fetch('/api/config').then(r => r.json());
If I deploy the app online or if I use yarn run dev-server
, there is no problem, it works. Is this a normal thing to happen? Should I try to fix this, or is it something normal?