BuildMidBackendAuto-graded
Build a URL matcher with params and wildcards
Resolve each request to its handler with static segments, :id params and * wildcards, even when several routes match.match(method, path, routes) takes a request and a route table and returns the handler with its captured params, or None. A pattern segment is a literal, a named param (:id, one segment) or a wildcard (*, the rest of the path). Some requests currently resolve to the wrong handler. It has to follow the rules in router.py: the method must match, the more specific segment wins, and the order of the table never changes the result.35 min
python
You're done when
- A fixed set of routes and requests resolves to the expected handlers and params.
- Reordering the route table doesn't change any result.
- A static segment wins over a named param that would also match.
- A request with the right path but the wrong HTTP method doesn't match.
- Named params and wildcards come back in the returned params with the right values.
- A path that matches no route returns
Noneand doesn't raise.
What it measures
API designWhether the matcher behaves the way people using the framework expect.
Algorithm designPicking the same route for the same request however the table is ordered.
Specificity rulesWhether a static segment beats a param or wildcard at the same position.
Your environment
Terminal + editorA full shell in the browser
Coding agentAlready signed in, no API key to set up
Isolated workspaceOnly yours, wiped when you finish
Start this lab
35 min
Start labYou'll need to sign in to Anthropos first. The lab opens in a private cloud workspace with your coding agent ready to use.AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo