Ananto30 / golpo-express

Backend of the Social Network - Golpo
https://golpo.vercel.app
4 stars 15 forks source link

API contracts are being tested manually in each controller #6

Closed deepanshu2506 closed 3 years ago

deepanshu2506 commented 3 years ago

currently all the input validations and sanitization is being done manually in each controller.

I would like to propose a middleware that takes care of validation and sanitization according to a schema as required by the API.

Ananto30 commented 3 years ago

Awesome! Would you please share a simple example? Like how will you get the schema?

deepanshu2506 commented 3 years ago

Awesome! Would you please share a simple example? Like how will you get the schema?

it would be using schema validation in express-validator and there will be a wrapper middleware around that.

Ananto30 commented 3 years ago

Cool! Please go on 🙏