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 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
o now I am ready to deploy this application LIVE,
when I deploy React/Next.js application - it can be accessed on some specific domain let's say mysite.com
when I deploy a middleware application - I should also expose it to the world on a specific domain let's say api.mysite.com

I 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
ould you please help me with that ?
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 prod use the hostname of your service, then SDK will be sending requests to that hostname
Was this page helpful?