mkappworks cloudzilla internal router router.go
Blame for internal/router/router.go
internal/router/router.go
27 lines · 2 contributors| Last commit | Line | Code |
|---|---|---|
| 1 | package router | |
| 2 | ||
| 3 | import ( | |
| 4 | "net/http" | |
| 5 | ||
| 6 | "github.com/go-chi/chi/v5" | |
| 7 | "github.com/mkappworks-dev/cloudzilla-app/internal/handler" | |
| 8 | ) | |
| 9 | ||
| 10 | // New returns a chi router with all Cloudzilla routes registered. | |
| 11 | func New(h *handler.Handlers) http.Handler { | |
| 12 | r := chi.NewRouter() | |
| 13 | ||
| 14 | r.Get("/", h.Home) | |
| 15 | r.Get("/explore", h.Explore) | |
| 16 | ||
| 17 | r.Route("/{owner}/{repo}", func(r chi.Router) { | |
| 18 | r.Get("/", h.PageRepo) | |
| 19 | r.Get("/tree/*", h.PageTree) | |
| 20 | r.Get("/blob/*", h.PageBlob) | |
| 21 | r.Get("/blame/*", h.PageBlame) | |
| 22 | r.Get("/commits/*", h.PageCommits) | |
| 23 | r.Get("/pulse", h.PagePulse) | |
| 24 | }) | |
| 25 | ||
| 26 | return r | |
| 27 | } |
A vertical bar marks consecutive lines from the same commit — only the first row in each run shows the commit metadata.