W
W
whiteleaf2018-02-09 13:24:21
Domain Name System
whiteleaf, 2018-02-09 13:24:21

How to properly build architecture on express & angular (API)?

Good afternoon!
Tell me, please, a few points:
1. How can I make it so that I can take out such as the Admin panel to a higher level? (admin.site.com)
How is this done and how can it be done better? Angular can't handle this, I understand. You need to either redirect to a separate "site" (completely autonomous) on express'e, or in some other way, so that everything is together.
2. Regarding the API. In all the video tutorials that I have seen, the API is completely open and anyone can get information from the database outside of Angular.js. is this correct, or do people tend to secure their API in some way and only give access to it through requests with Angular?
3. How to properly connect to the database (MongoDB), namely regarding the following:
I have a connection to the database every time I need to get some information from a specific model. It seems to me that this slows down the application speed a lot. Can people somehow connect with mongoose at the entry point (server, js), and already all other requests do not require connections, and only then they simply receive data on an open connection all models at once? Am I right or not? How is this done in practice in real projects?
If someone has a working example on a bunch - Express, Node.js, Angular & MongoDB? It would help me a lot - to visually walk and see how everything is implemented in practice in real projects.
I would be very grateful for the answers to the above questions.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
marataziat, 2018-02-09
@marataziat

1. Subdomain
2. Use cookies, and unique sessions. Learn how authorization works.
3. Yes, not really, you can make a crutch in the form of an active connection to mongodb and you will send all requests to the crutch there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question