209 похожих чатов

Всем прывэйт, на связи снова я. В связи с известными

политическими событиями и на фоне того, что я перебрал кумыса и снова сидел час (с перерывами) на толчке, а также в связи с тем, что хочу превратить весь код бэкенда в один сплошной поток, я собираюсь инжектить observable в контроллеры и классы-хелперы.

Вопрос: как правильно организовать классы-хелперы в контроллере/сервисе, который обработает данные? По принципу фасада? Или как-то по-другому?

Просто бизнес-логики куча - создай 4-5 сущностей, каждую по-своему обработай и залей в свою БД и во внешнее API. Сейчас вся эта лапша лежит в 1000 строк прямо в контроллере, а по идее надо разбить этот код по отдельным файлам для наглядности. Каким способом это сделать? Фасад для контроллера? Или весь код выпилить в сервис, и уже распиливать это в фасад для сервиса? Или на каждую сущность свой сервис?

2 ответов

4 просмотра

главное alahAkbar.ts не помещай в фасады @HavaNagila

Kenya-West-️ Автор вопроса

Тут ещё суть в том, что у меня Nest работает на Fastify, и контроллер у меня полностью берёт контроль над обработкой запроса и выдачей ответа. Если вдруг что-то в моём потоке засбоит и не сразу выдаст catchError, то могу ли я дать, например, время 40 секунд для обработки запроса, запустить поток и если в subscribe() за 40 секунд ничего не упадет - то я выдаю res.send(INTERNALERROR, 'я пытался')? Антипаттерн?

Похожие вопросы

Обсуждают сегодня

isn't utxo commitements pretty close though if someone wanted to get it over the finish line? my understanding is that most of the ground work was already down by verde
Luke High - Rabbi Of Bcash High Rabbi Of Bcash
23
is the buyback program live and at what prices are the purchases fixed? excuse me for the bland PA question, sophisticated defi people keke
Imnothere
20
@samkazemian - couple questions: Update on frxBTC? - This would do well with the current influx of institutional investment entering the space Update on future veFXS streams...
Costi
16
Hi, I was reading this https://twitter.com/HouseofChimera/status/1778078991762780408 about Verasity and their likely choice of Tron as blockchain for their token for its low f...
Jordi
13
I arrived here after a Chico Crypto show highlighted the project & the Team - the fact that the Team had a long history of successfully working with household names gave me e...
Banter is Bullish
5
Hey Ocean. What with the new alliance, do you have any plans to offer Atomspace semantic data as one of the served data types? Do you already offer this with another graph for...
MatthewEN
9
Are there any detailed videos on the May 15 $BCH upgrade going over all the new changes that are coming up next week for $BCH ?
🆃🆁🅾🅽 🅷🅰🅲🅺🅴🆁
9
Does anyone here have a connection Mullvad? it would be nice to know what it would take to have them accept BCH 0-conf.
tl121x
16
Can an XMR transaction be tracked from its sender to its receiver by performing blockchain analysis, no matter how many addresses are used?
Trkz342
16
hey i couldn't add more EWT to the stake so i unstaked, now i can't seem to find the stake option, know why? also i was in the screenshot for more than 3k EWT, when this pool...
Hogsss
7
Карта сайта