1diff --git a/go.mod b/go.mod
2index eabf863a1cad6dd1f4d7987411f42b61998c30f6..5bd4d7647b43cb737a873b5636a162a1ea25df69 100644
3--- a/go.mod
4+++ b/go.mod
5@@ -8,7 +8,6 @@ github.com/alecthomas/chroma/v2 v2.13.0
6 github.com/go-git/go-git/v5 v5.12.0
7 github.com/gomarkdown/markdown v0.0.0-20240419095408-642f0ee99ae2
8 github.com/google/go-cmp v0.6.0
9- github.com/gorilla/mux v1.8.1
10 github.com/valyala/quicktemplate v1.7.0
11 golang.org/x/sync v0.7.0
12 )
13diff --git a/go.sum b/go.sum
14index bc82b643fa7d12dfe3959e2d53a409f8defb51cb..69c34b73d113fa1f0ae49c5068a2517c3ee91725 100644
15--- a/go.sum
16+++ b/go.sum
17@@ -51,8 +51,6 @@ github.com/gomarkdown/markdown v0.0.0-20240419095408-642f0ee99ae2 h1:yEt5djSYb4iNtmV9iJGVday+i4e9u6Mrn5iP64HH5QM=
18 github.com/gomarkdown/markdown v0.0.0-20240419095408-642f0ee99ae2/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA=
19 github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
20 github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
21-github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
22-github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
23 github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
24 github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
25 github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
26diff --git a/pkg/handler/git/handler.go b/pkg/handler/git/handler.go
27index b77bcfc0e35d58f47b6fd5a08e74a23fa4d3735f..e2f40422ed212156620190800a9ec6569bc4c11f 100644
28--- a/pkg/handler/git/handler.go
29+++ b/pkg/handler/git/handler.go
30@@ -8,7 +8,6 @@ "git.gabrielgio.me/cerrado/pkg/service"
31 "git.gabrielgio.me/cerrado/templates"
32 "github.com/go-git/go-git/v5/plumbing"
33 "github.com/go-git/go-git/v5/plumbing/object"
34- "github.com/gorilla/mux"
35 )
36
37 type (
38@@ -43,7 +42,7 @@ templates.WritePageTemplate(w, gitList)
39 }
40
41 func (g *GitHandler) Summary(w http.ResponseWriter, r *http.Request) {
42- name := mux.Vars(r)["name"]
43+ name := r.PathValue("name")
44 ref, err := g.gitService.GetHead(name)
45 if err != nil {
46 slog.Error("Error loading head", "error", err)
47@@ -59,7 +58,7 @@ templates.WritePageTemplate(w, gitList)
48 }
49
50 func (g *GitHandler) About(w http.ResponseWriter, r *http.Request) {
51- name := mux.Vars(r)["name"]
52+ name := r.PathValue("name")
53 ref, err := g.gitService.GetHead(name)
54 if err != nil {
55 slog.Error("Error loading head", "error", err)
56@@ -74,7 +73,7 @@ templates.WritePageTemplate(w, gitList)
57 }
58
59 func (g *GitHandler) Refs(w http.ResponseWriter, r *http.Request) {
60- name := mux.Vars(r)["name"]
61+ name := r.PathValue("name")
62
63 tags, err := g.gitService.ListTags(name)
64 if err != nil {
65@@ -106,8 +105,8 @@ templates.WritePageTemplate(w, gitList)
66 }
67
68 func (g *GitHandler) Tree(w http.ResponseWriter, r *http.Request) {
69- name := mux.Vars(r)["name"]
70- ref := mux.Vars(r)["ref"]
71+ name := r.PathValue("name")
72+ ref := r.PathValue("ref")
73 gitList := &templates.GitItemPage{
74 Name: name,
75 Ref: ref,
76@@ -117,8 +116,8 @@ templates.WritePageTemplate(w, gitList)
77 }
78
79 func (g *GitHandler) Log(w http.ResponseWriter, r *http.Request) {
80- name := mux.Vars(r)["name"]
81- ref := mux.Vars(r)["ref"]
82+ name := r.PathValue("name")
83+ ref := r.PathValue("ref")
84
85 commits, err := g.gitService.ListCommits(name, ref)
86 if err != nil {
87diff --git a/pkg/handler/router.go b/pkg/handler/router.go
88index 79f70f11e263dbac66bf9660a97a4514b0dfd5fb..bdf883ed8a8af090669e285504118bda8d86450a 100644
89--- a/pkg/handler/router.go
90+++ b/pkg/handler/router.go
91@@ -9,7 +9,6 @@ "git.gabrielgio.me/cerrado/pkg/handler/config"
92 "git.gabrielgio.me/cerrado/pkg/handler/git"
93 "git.gabrielgio.me/cerrado/pkg/handler/static"
94 "git.gabrielgio.me/cerrado/pkg/service"
95- "github.com/gorilla/mux"
96 )
97
98 // Mount handler gets the requires service and repository to build the handlers
99@@ -25,17 +24,17 @@ aboutHandler = about.NewAboutHandler(configRepo)
100 configHander = config.ConfigFile(configRepo)
101 )
102
103- staticHandler, err := static.NewStaticHander("/static/")
104+ staticHandler, err := static.ServeStaticHandler()
105 if err != nil {
106 return nil, err
107 }
108
109- mux := mux.NewRouter()
110+ mux := http.NewServeMux()
111
112- mux.PathPrefix("/static").Handler(staticHandler)
113- mux.HandleFunc("/{name}/about", gitHandler.About)
114+ mux.HandleFunc("/static/{file}", staticHandler)
115+ mux.HandleFunc("/{name}/about/{$}", gitHandler.About)
116 mux.HandleFunc("/{name}", gitHandler.Summary)
117- mux.HandleFunc("/{name}/refs", gitHandler.Refs)
118+ mux.HandleFunc("/{name}/refs/{$}", gitHandler.Refs)
119 mux.HandleFunc("/{name}/tree/{ref}", gitHandler.Tree)
120 mux.HandleFunc("/{name}/log/{ref}", gitHandler.Log)
121 mux.HandleFunc("/config", configHander)
122diff --git a/pkg/handler/static/handler.go b/pkg/handler/static/handler.go
123index 6a826cc988aa4d11f5f71417b4a3198a7d611882..a8b458324580082c2424b21a65d92c2849e6a836 100644
124--- a/pkg/handler/static/handler.go
125+++ b/pkg/handler/static/handler.go
126@@ -7,12 +7,15 @@
127 "git.gabrielgio.me/cerrado/static"
128 )
129
130-func NewStaticHander(prefix string) (http.Handler, error) {
131+func ServeStaticHandler() (func(w http.ResponseWriter, r *http.Request), error) {
132 staticFs, err := fs.Sub(static.Static, ".")
133 if err != nil {
134 return nil, err
135 }
136
137- handler := http.StripPrefix(prefix, http.FileServer(http.FS(staticFs)))
138- return handler, nil
139+ return func(w http.ResponseWriter, r *http.Request) {
140+ f := r.PathValue("file")
141+
142+ http.ServeFileFS(w, r, staticFs, f)
143+ }, nil
144 }