Concert Seat Booking API
Level 2 · node/express · Concurrency · Concurrency (race condition)
Scenario
Build a concert seat booking service. POST /seats/:id/book checks whether a seat is free and books it for the requester.
Requirements
- Store seat state in an in-memory Map - Return 409 for an already-booked seat - Return 200 and seat data on success - Exactly one concurrent request for a seat may succeed
Acceptance criteria
- An empty seat booking returns 200 with booking data
- An already-booked seat returns 409
- Exactly one concurrent request for the same seat succeeds