Deploy Vuestorefront with Docker
Hi community,
I am trying to understand the deployment part.
So I have a vuestorefron application running React/Next.js
I have a vuestorefront integration with (custom)
When I connected React/Next.js with integration - locally, the integration server is running on the
when in React/Next.js app I call
when I deploy React/Next.js application - it can be accessed on some specific domain let's say
when I deploy a middleware application - I should also expose it to the world on a specific domain let's say
I can't understand what should I configure in the React/Next.js application during
Or maybe I am doing something wrong ?
Thank you!
I am trying to understand the deployment part.
So I have a vuestorefron application running React/Next.js
I have a vuestorefront integration with (custom)
When I connected React/Next.js with integration - locally, the integration server is running on the
http://localhost:8181/when in React/Next.js app I call
sdk.customIntegration.generateCustomerToken(payload) - I can see in Chrome Devtools that it does POST request to an endpoint
http://localhost:8181/customIntegration/generateCustomerToken
when I deploy React/Next.js application - it can be accessed on some specific domain let's say
mysite.comwhen I deploy a middleware application - I should also expose it to the world on a specific domain let's say
api.mysite.comI can't understand what should I configure in the React/Next.js application during
build time, so that when the application calls SDK sdk.customIntegration.generateCustomerToken(payload) - it does POST request to
http://api.mysite.com/customIntegration/generateCustomerToken
Or maybe I am doing something wrong ?
Thank you!
Solution
hey, when you init SDK you are providing it middleware URL, right?
example:
const { ct } = initSDK({
ct: buildModule(ctModule, {
apiUrl: 'http://localhost:8181/ct'
})
});
cons
you can add a conditional statement here, that if it's in
example:
const { ct } = initSDK({
ct: buildModule(ctModule, {
apiUrl: 'http://localhost:8181/ct'
})
});
cons
you can add a conditional statement here, that if it's in
prod use the hostname of your service, then SDK will be sending requests to that hostname