PROG3017 FullStack Lab3C
PROG3017 FullStack Lab3C
Prerequisites
Postman or similar client ready to perform your actions against your endpoint.
You’ll use your already created repository for Lab3B. You should have Lab3B already
completed and fully submitted (including your screencast video) before beginning this
portion of the lab.
The accompanying class lecture.
Instructions
In continuing your exploration of Express JS and creating an API endpoint, complete the
following steps to add to your already created API from Lab 3B
Validation
Using the Joi NPM package joi (https://www.npmjs.com/package/joi), create a function
called validatePerson() which receives a submitted person object and executes the
following validation on that object
o first_name – required, has a minimum length of 3 and a maximum length of 30
o last_name – required, has a minimum length of 3 and a maximum length of 30
o email – required and must be a valid email format
o job_title – optional, but when provided it must be one of the following values
Structural Engineer
Chief Design Engineer
Desktop Support Technician
Sales Associate
Apply Validation to any endpoint that is deemed to require validation of submitted data.
Modularize the function into its own .js file and demonstrate the importing of the module
using import and export (esmodules).
Middleware