git-preview @ main

static git web frontend but with images and html previews + code truncation

routes/handler.go

 1package routes
 2
 3import (
 4	"net/http"
 5
 6	"github.com/jxc2000-b/git-preview/config"
 7)
 8
 9func Handlers(c *config.Config) *http.ServeMux {
10	mux := http.NewServeMux()
11	d := deps{c}
12
13	mux.HandleFunc("GET /", d.Index)
14	mux.HandleFunc("GET /static/{file}", d.ServeStatic)
15	mux.HandleFunc("GET /{name}", d.RepoIndex)
16	mux.HandleFunc("GET /{name}/tree/{ref}/{rest...}", d.RepoTree)
17	mux.HandleFunc("GET /{name}/blob/{ref}/{rest...}", d.FileContent)
18	mux.HandleFunc("GET /{name}/log/{ref}", d.Log)
19	mux.HandleFunc("GET /{name}/commit/{ref}", d.Diff)
20	mux.HandleFunc("GET /{name}/showcase/{ref}/{rest...}", d.ShowcaseAsset)
21	mux.HandleFunc("GET /{name}/{rest...}", d.RepoIndex)
22
23	return mux
24}