code_route
code_route resolves an HTTP route path to the controller method that handles it. It parses framework decorators (NestJS, Express, Fastify) and returns the handler’s file and line number.
code_route(route="/api/users")code_route(route="/api/orders", method="POST")code_route()Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
route | string | — | URL path to find a handler for |
method | "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | — | HTTP method filter |
Output
Section titled “Output”GET /api/users → UserController.list src/controllers/user.ts:24
POST /api/users → UserController.create src/controllers/user.ts:51Calling code_route() with no arguments lists all registered routes.
When to use
Section titled “When to use”- Trace a failing API request to its handler
- Find which function to read when debugging a specific endpoint
- Get a full route inventory for documentation or security review
Related
Section titled “Related”For a full chain from route through service to database, use code_route_trace:
code_route_trace(route="/api/users", method="POST")→ Router → UserController.create → UserService.create → db.insert