Step 2: Source
Let us explore the source file:
-
Open the
src/model/User.jsfile. Notice a user has anameandemail! -
Open the
src/data/UserDao.jsfile. Notice we use Zod for input validation. Most of error handling happens at the Schema level and Data Access Object (but not in route handler). -
Open the
src/routes/users.jsfile where we have route handlers. Write Postman request for every route (no need to make erroneous requests).
Notive the use of debug statements in the source files. Review src/debug.js
file. To enable printing debug messages, add DEBUG=roster:* to .env.