You can use APP_URL environment variable for it.
const url = `${process.env.APP_URL}/api/awesome-logic`
It’s set through checkout ui extension build process so that the url will be cloudflare tunneling url in local and hosting url in production.