App.request different url in dev and prod


How can I use different urls with app.request in dev and prod?
For development I need “$'http://localhost:8080/…”, in production $'https://mydomain.xx/

Currently I do a search and replace but there must be a better way…
Is it possible to set a variable to different values in prod and dev?
I use F7 core.

If your url same as domain, you can use window.origin as the hostname.

or with variable

const hostname = window.origin == “http://localhost:8080” ? “http://localhost:8080” : “https://mydomain.xx

If you use Vite bundler then you can do it like so:

$ ?  'https://mydomain.xx' : 'http://localhost:8080')

You could use a global variable for the URL and just change the one variable before build. Reference the variable throughout your code instead of hard-coding the URL into each function.