I'm using ASP.NET Core 3.1 with the React template and so far everything works fine.
But to test my frontend changes locally without always pushing to the server (on which the data is stored), I'm trying to figure out if and how I can change the base-URL my fetch requests go to. For example my login fetch request looks like the following:
fetch('api/authentication/login', requestOptions).then(..)
Which then defaults to
localhost:5000/api/authentication/login
Is there a way I can replace the base-URL with my server-URL to work with the data on the server? I've already tried changing
ReactDOM.render(
<BrowserRouter basename={baseUrl}>
<App />
</BrowserRouter>,
rootElement
);
to
ReactDOM.render(
<BrowserRouter basename={"http://my-server-url.com"}>
<App />
</BrowserRouter>,
rootElement
);
Unfortunately that changed nothing but I can't find a different thing to try.
Is there a way to get this running?