Answer the question
In order to leave comments, you need to log in
How to change the domain for sending back requests depending on the deployment?
My react application is on gitlab and 2 deployments are configured through gitlab-ci: on dev (for developers and testers) and preprod (for customers). Looks like this .
At the same time, webpack is very minimalistic, here it is .
And the server is simple on the node .
Now the front is making back requests for one domain. Approximately like this:
const BASE_URL = 'https://account.b2b-staging.kpb.lt/account'
const result = axios({
method: 'GET',
url: `${BASE_URL}/users`
})
Answer the question
In order to leave comments, you need to log in
There are many options. You can, for example, use the define plugin in the webpack in the dev and prod assembly. In fact, depending on env, you will have your own config for the desired version
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question