☑Kizspy.me
o Response Example:
"token": "eyJhbGci0iJIUZI1NiIsInR5cCI6..."
Question 4 (2.5 points) - Borrow a Book (Requires JWT)
Zoom
Objective:
Create an authenticated API to borrow a book. The user must be logged in and have a valid
token. Save a new Borrow record in the database.
• Endpoint: POST/api/borrow/borrow
• Headers:
Authorization: Bearer <JWT_TOKEN>

Processing Requirements:
。 Validate book availability (must have availableCopies > 0).
о Reduce availableCopies by 1.
+100%
5
Close