Glossary: Building APIs with FastAPI
Route order
Also written: declare fixed paths first
FastAPI tries paths in the order they are declared, so a fixed path like `/products/cheapest` must come before `/products/{product_id}`. Otherwise the parameter path matches first and gives a 422.