Answer the question
In order to leave comments, you need to log in
How to organize data validation in API?
I am writing a pet project, I have a question about api (it's on the express node, but it's probably not the point) - or rather, about validation.
The request goes through a series of middlewares:
router.delete(
"/:id",
middlewares.isAuthed,
schemaValidation.deletePost, // проверяю поступающие данные
dataValidation.deletePost, // проверяю, согласуются ли поступающие данные с записями в БД
controllers.deletePost // передаю данные в метод соотв. сервиса
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question