In a provided Spring Boot project on HackerRank CodePair, implement the specified REST endpoints (8 endpoints in 45 minutes), then explain how your implementation would look in a real production environment. Asked in the Round 2 (Staff Software Engineer) stage. The interviewer switched after 3 endpoints to production concerns, and the candidate was dinged for missing exception handling in the first version.
For this coding exercise, implement the routing core as dispatch_requests(routes, requests). Each route has method, path, and response; paths may contain {parameter} segments. Each request has method and path. Return one result per request with status 200, extracted parameters, and the route response, or status 404 when no method and path match. Prefer an exact static route over a parameterized route.
{name}def dispatch_requests(routes, requests):