Change into your project directory.
cd galvanize-bookshelf
Ensure the staging area of the master
branch is clean. Then, create and checkout a new feature branch.
git checkout -b validations
Install the following NPM packages.
npm install --save joi@^9.0.4 express-validation
Make a new validations
directory.
mkdir validations
And create one validation file per route file.
touch validations/authors.js
touch validations/books.js
touch validations/token.js
touch validations/users.js
Then, add rules to validate the req.body
of all POST
requests for the following route files.
routes/authors.js
routes/books.js
routes/token.js
routes/users.js
Then, add rules to validate the req.body
of all PATCH
requests for the following route files.
routes/authors.js
routes/books.js