V
V
Vladimir Golub2020-01-30 16:31:21
Node.js
Vladimir Golub, 2020-01-30 16:31:21

Is it possible to use other controllers in controllers?

Is it possible to use other controllers in controllers? How is it correct from the point of view of architecture?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Romashkan, 2020-01-30
@EvgeniiR

Vladimir Golub ,

There is a function to check the password and login, it takes information from env. Maybe it's a model at all? It is used in two controllers.

Read about the middleware pattern, and check the login and password in one place - before calling the controller.
In JS:
https://expressjs.com/en/guide/using-middleware.html and
https://stackoverflow.com/questions/12921658/use-s...

A
Adamos, 2020-01-30
@Adamos

...
10. Do not boil a goatling in its mother's milk.
11. Don't use controller calls in another controller, separate common code into separate classes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question