Skip to content

Instantly share code, notes, and snippets.

@IanSmith89
Created July 7, 2016 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save IanSmith89/90c2f4d7d9a9df92bfe75b65d19ea1ce to your computer and use it in GitHub Desktop.
Save IanSmith89/90c2f4d7d9a9df92bfe75b65d19ea1ce to your computer and use it in GitHub Desktop.
Galvanize Bookshelf Validations

User Input Validation

After changing into your project directory for Galvanize Bookshelf, ensure the master branch is clean and make a new branch called validations

cd PATH_TO/galvanize_bookshelf
git checkout -b validations

In a new directory called validations, create validation files for each routes file

mkdir validations
touch validations/users.js
touch validations/session.js
touch validations/books.js
touch validations/authors.js

Add the rules in each that validates the req.body of all POST or PUT

Bonus

Add the rules to validate any of the PATCH requests

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment