Data Validation
Sending data from your API to the database only to find out that the input is invalid is unnecessarily expensive. Far better is to test the data on the way in to make sure it meets basic criteria. This preliminary set of tests (known as validation) examines the input data to make sure it meets the minimum criteria and that it is formatted properly.
In this chapter, you will learn the following:
- How to validate input data
- How to respond to invalid data