diff options
author | Anirudh Oppiliappan <x@icyphox.sh> | 2022-12-12 20:53:58 +0530 |
---|---|---|
committer | Anirudh Oppiliappan <x@icyphox.sh> | 2022-12-12 20:53:58 +0530 |
commit | 82b8afe19b77fe02e1a29a5b5e20882d8e5c3fc5 (patch) | |
tree | 2173a518664b81e0134853c4c6dee09973377a87 /routes/handler.go | |
parent | 7d99afc5cd3ddfc7a875754f4593812b8c2664c8 (diff) | |
download | legit-82b8afe19b77fe02e1a29a5b5e20882d8e5c3fc5.tar.gz legit-82b8afe19b77fe02e1a29a5b5e20882d8e5c3fc5.tar.bz2 legit-82b8afe19b77fe02e1a29a5b5e20882d8e5c3fc5.zip |
routes: render readme
Diffstat (limited to 'routes/handler.go')
-rw-r--r-- | routes/handler.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/routes/handler.go b/routes/handler.go index 2625b43..0c4f7b8 100644 --- a/routes/handler.go +++ b/routes/handler.go @@ -1,6 +1,8 @@ package routes import ( + "net/http" + "github.com/alexedwards/flow" "icyphox.sh/legit/config" ) @@ -8,6 +10,12 @@ import ( func Handlers(c *config.Config) *flow.Mux { mux := flow.New() d := deps{c} + + mux.NotFound = http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + d.Write404(w) + }) + + mux.HandleFunc("/", d.Index, "GET") mux.HandleFunc("/:name", d.RepoIndex, "GET") mux.HandleFunc("/:name/tree/:ref/...", d.RepoTree, "GET") mux.HandleFunc("/:name/blob/:ref/...", d.FileContent, "GET") |