aboutsummaryrefslogtreecommitdiff
path: root/pkg/handler/router.go
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-06-01 20:20:00 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-06-01 20:20:00 +0200
commitd0e0c1eb99303e1000140d4b98c610077278dc42 (patch)
tree30f9bc8dba73df5a6bdf2fc20041120881fe4e57 /pkg/handler/router.go
parente3705f35c642e578625ce4574d189fa0b0869403 (diff)
downloadcerrado-d0e0c1eb99303e1000140d4b98c610077278dc42.tar.gz
cerrado-d0e0c1eb99303e1000140d4b98c610077278dc42.tar.bz2
cerrado-d0e0c1eb99303e1000140d4b98c610077278dc42.zip
ref: Remove mux
Diffstat (limited to 'pkg/handler/router.go')
-rw-r--r--pkg/handler/router.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/pkg/handler/router.go b/pkg/handler/router.go
index 79f70f1..bdf883e 100644
--- a/pkg/handler/router.go
+++ b/pkg/handler/router.go
@@ -9,7 +9,6 @@ import (
"git.gabrielgio.me/cerrado/pkg/handler/git"
"git.gabrielgio.me/cerrado/pkg/handler/static"
"git.gabrielgio.me/cerrado/pkg/service"
- "github.com/gorilla/mux"
)
// Mount handler gets the requires service and repository to build the handlers
@@ -25,17 +24,17 @@ func MountHandler(
configHander = config.ConfigFile(configRepo)
)
- staticHandler, err := static.NewStaticHander("/static/")
+ staticHandler, err := static.ServeStaticHandler()
if err != nil {
return nil, err
}
- mux := mux.NewRouter()
+ mux := http.NewServeMux()
- mux.PathPrefix("/static").Handler(staticHandler)
- mux.HandleFunc("/{name}/about", gitHandler.About)
+ 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}/refs/{$}", gitHandler.Refs)
mux.HandleFunc("/{name}/tree/{ref}", gitHandler.Tree)
mux.HandleFunc("/{name}/log/{ref}", gitHandler.Log)
mux.HandleFunc("/config", configHander)