M
M
maxnilov2017-07-24 15:18:44
Angular
maxnilov, 2017-07-24 15:18:44

Is it possible to hide the api address?

Understanding angular 4
Making a simple news site.
It turns out on angular - frontend - I show news to the user.
Data is stored and read from firebase.
It's not entirely clear:
1. Everything that I program (frontend) - it is all visible to the user when viewing the code. That is, if desired, he can delve into the frontend code.
2. It turns out physically the data from the database is received by the script on the client - in the user's browser. That is, if desired, the user can see the address of the backend. Everyone recommends doing a rest api and giving data in json format. And since the site is without registration, the user himself can receive data directly from firebase using this backend. And for example, completely download my site.
3. It turns out that if you use firebase, then knowing its address, you can contact anyone directly with it. For example, embed my backend data elsewhere. For example, make your own frontend and show my data?
4. That is, recommendations for using the angular + rest api bundle - is this a project with authorization, in which all logic is hidden in the backend, and the frontend only shows data in the backend?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
davidnum95, 2017-07-24
@davidnum95

That 's what CORS is for .

D
Dmitry Shnyrev, 2017-08-03
@dmnBrest

If the API is open, then it is already open to everyone and you can’t close it with anything on the frontend.
Even if the code is minified and unreadable as mentioned above, then the API requests themselves are very easy to see in the browser console or using special proxies. And then these requests can be played from anywhere and in any way. If you close the API, then only by authorization. Everything else is a waste of your time on an empty topic. If someone is interested in your API, it will be rather a plus for the fact that the project is developing in the right direction and is a success :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question