aboutsummaryrefslogtreecommitdiff
path: root/pkg/handler/router.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/handler/router.go')
-rw-r--r--pkg/handler/router.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/pkg/handler/router.go b/pkg/handler/router.go
index ed782f7..de5117c 100644
--- a/pkg/handler/router.go
+++ b/pkg/handler/router.go
@@ -4,6 +4,7 @@ import (
"net/http"
serverconfig "git.gabrielgio.me/cerrado/pkg/config"
+ "git.gabrielgio.me/cerrado/pkg/ext"
"git.gabrielgio.me/cerrado/pkg/handler/about"
"git.gabrielgio.me/cerrado/pkg/handler/config"
"git.gabrielgio.me/cerrado/pkg/handler/git"
@@ -31,15 +32,19 @@ func MountHandler(
mux := http.NewServeMux()
- mux.HandleFunc("/static/{file}", staticHandler)
- mux.HandleFunc("/{name}/about/{$}", gitHandler.About)
- mux.HandleFunc("/{name}", gitHandler.Summary)
- mux.HandleFunc("/{name}/refs/{$}", gitHandler.Refs)
- mux.HandleFunc("/{name}/tree/{ref}/{rest...}", gitHandler.Tree)
- mux.HandleFunc("/{name}/blob/{ref}/{rest...}", gitHandler.Blob)
- mux.HandleFunc("/{name}/log/{ref}", gitHandler.Log)
- mux.HandleFunc("/config", configHander)
- mux.HandleFunc("/about", aboutHandler.About)
- mux.HandleFunc("/", gitHandler.List)
+ mux.HandleFunc("/static/{file}", m(staticHandler))
+ mux.HandleFunc("/{name}/about/{$}", m(gitHandler.About))
+ mux.HandleFunc("/{name}", m(gitHandler.Summary))
+ mux.HandleFunc("/{name}/refs/{$}", m(gitHandler.Refs))
+ mux.HandleFunc("/{name}/tree/{ref}/{rest...}", m(gitHandler.Tree))
+ mux.HandleFunc("/{name}/blob/{ref}/{rest...}", m(gitHandler.Blob))
+ mux.HandleFunc("/{name}/log/{ref}", m(gitHandler.Log))
+ mux.HandleFunc("/config", m(configHander))
+ mux.HandleFunc("/about", m(aboutHandler.About))
+ mux.HandleFunc("/", m(gitHandler.List))
return mux, nil
}
+
+func m(next func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {
+ return ext.Compress(next)
+}