Skip to content

Instantly share code, notes, and snippets.

@D7Torres
Created December 6, 2019 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save D7Torres/238171803c1b38d970dfb5651de1e8c6 to your computer and use it in GitHub Desktop.
Save D7Torres/238171803c1b38d970dfb5651de1e8c6 to your computer and use it in GitHub Desktop.
Endpoint Refactor - endpoint function final result
...
function endpoint(service, version = '') {
const protocol = getProtocol(service, __SERVER__, __ENV__)
const subdomain = getSubdomain(service, __SERVER__, __ENV__)
const path = getPath(service, __SERVER__, __ENV__, version)
const port = getPort(service, __ENV__, __CLIENT__)
return `${protocol}://${subdomain}.${__DOMAIN__}${port}${path}`
}
export default endpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment