CodeGraph 偵測 web framework 的路由檔案,產出 route 節點,用 references 邊連結到對應的 handler class / 函式。你查某個 view / controller 的 callers 時,會順帶看到綁定它的 URL 模式——「這支 API 誰在呼叫?」變成「這支 API 對應哪條 URL、被誰呼叫」一次回答。
| Framework | 認得的寫法 |
|---|---|
| Django | path()、re_path()、url()、include() in urls.py(CBV .as_view()、dotted paths) |
| Flask | @app.route('/path', methods=[...])、blueprint routes |
| FastAPI | @app.get(...)、@router.post(...)、所有標準 methods |
| Express | app.get(...)、router.post(...) 帶 middleware chain |
| NestJS | @Controller + @Get/@Post/…、GraphQL @Resolver + @Query/@Mutation、@MessagePattern/@EventPattern、@SubscribeMessage |
| Laravel | Route::get()、Route::resource()、Controller@action、tuple syntax |
| Drupal | *.routing.yml routes(_controller、_form、entity handlers);hook_* 在 .module/.theme/.install/.inc |
| Rails | get '/x', to: 'users#index'、hash-rocket => syntax |
| Spring | @GetMapping、@PostMapping、@RequestMapping on methods |
| Play | GET/POST/… verb routes in conf/routes → Controller.method actions(Scala + Java) |
| Gin / chi / gorilla / mux | r.GET(...)、router.HandleFunc(...) |
| Axum / actix / Rocket | .route("/x", get(handler)) |
| ASP.NET | [HttpGet("/x")] attributes on action methods |
| Vapor | app.get("x", use: handler) |
| React Router / SvelteKit | Route component nodes |
| Vue Router / Nuxt | pages/ file-based routes、server/api/ endpoints、route middleware |
| Astro | src/pages/ file-based routes(.astro pages + .ts endpoints、[param]/[...rest] syntax) |
官方在每個框架的 canonical app 上驗證過路由解析覆蓋率:Express 100%、FastAPI 98%、Flask 100%、NestJS 96.8%、Gin 96.5%、Axum 100%、Rocket 93.8%、Vapor 100%、Laravel 92%、Rails 89.6%、React Router 100%;convention/reflection 較重的則誠實停在靜態分析天花板:ASP.NET 83.9%、Spring 83.3%、Drupal 78.9%、Play 76.3%、Django 74.1%。SvelteKit / Vue / Nuxt / Astro 用 file-based routing,頁面/端點覆蓋率就是該語言本身的分數。
codegraph 自己的 repo 就有 16 個 route 節點(codegraph status 的 Nodes by Kind 顯示 route 16)——它在自己身上也偵測到了框架路由。