DEV Community

Discussion on: Svelte 3 - How to connect your app with a Rest API Axios

Collapse
 
rubendutchtelco profile image
RubenDutchtelco

You are correct about the fact that all front-end code is always visible to the end user.

I think the recommended method the author is referring to is a .env like file (npmjs.com/package/dotenv). Which does not hide the values but makes them more variable and easier to change without having to alter your code.
You might want your front-end connecting to different base URL's depending on what environment it is running (dev, staging, prod).

Collapse
 
hydracorey profile image
Corey Vincent

Thanks for the response. Your points make sense.

Thread Thread
 
bd_perez profile image
Bruno Pérez

Exact, the base url of the API is not a sensitive information. You can track all API calls with your browser devtools anyway