Hi guys! I was building a CLI tool and thought about creating an API to store some data, but I started wondering: How can I make it so the endpoint is not exposed?
In the web, we can save these as ENV VARS in the server, but in a CLI application that will be sent to NPM, how does that work?
I believe if I hardcode it, if the user install my NPM package and goes into the dir that has the code, the user will be able to see the endpoint, right?
#API calls from CLI
1 messages · Page 1 of 1 (latest)
Client side code can't hide the network location of the call, you could do some kind of auth or check to endpoint A, that returns the location of endpoint B, the client can then use endpoint B. But clients always have knowledge of where they are sending requests.
anything client side should be assumed as readable.
In cases where you need to prevent public access to an endpoint, you have to create an isolated network, where users are authenticated to that network, and the server side resources only allow access from specific IPs on that private isolated network.
I see I see, thank you so much @runic arrow ! 🙂
No prob. Client server architecture patterns ARE the web.