Step 2: Source
Let us explore the source file:
-
Open the
src/model/User.js
file. Notice a user has aname
andemail
! -
Open the
src/data/UserDao.js
file. 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.js
file 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
.