File
Blob: chord/handler.go
| 1 | package chord |
| 2 | |
| 3 | import ( |
| 4 | "net/http" |
| 5 | |
| 6 | "github.com/go-chi/chi/v5" |
| 7 | "github.com/go-chi/chi/v5/middleware" |
| 8 | ) |
| 9 | |
| 10 | func ChordStatsHandler(rootNode *LocalNode, virtualNodes []*LocalNode) http.Handler { |
| 11 | router := chi.NewRouter() |
| 12 | |
| 13 | router.Use(middleware.URLFormat) |
| 14 | router.Get("/stats", statsHandler(virtualNodes)) |
| 15 | router.Get("/graph", ringGraphHandler(rootNode)) |
| 16 | |
| 17 | return router |
| 18 | } |