Explanation guide · Section 4Example page
What happens when a patient books an appointment
When the patient submits the booking form, the frontend sends the details to the server. The server checks the time slot is still free, saves the booking, and queues a reminder.
- Booking form
- API route
- Check the slot
- Save to database
- Send reminder
Where to find it
backend/routes/appointments.js, in createAppointment()
Q. Why check the slot again on the server?
Because two people could choose the same time at once. The browser can’t see other users’ bookings; only the server can.
An illustrative example. Every guide is written for the project it explains.