My web app will be receiving a significant amount of user-generated content. To enhance basic security measures, I aim to validate the inputs created by users. Currently, my backend is powered by Node+Express.
How should I go about implementing input validation?
Should I use assert? Being familiar with Python, my initial instinct was to utilize assert statements: assert(title.length > 0)
Or perhaps express-validator? Upon further research, I came across form validation libraries like express-validator which seemed like a more structured approach. However, it also appeared that this method would require me to write significantly more lines of code compared to simple assertion statements.
Could TypeScript be the solution? I then considered the option of writing some of my Node code in TypeScript as a potential solution to handle all validations automatically.
What other options are available?
Which approach would be most suitable for my project?