routes: render readme
1 file changed, 8 insertions(+), 0 deletions(-)
changed files
M routes/handler.go → routes/handler.go
@@ -1,6 +1,8 @@ package routes import ( + "net/http" + "github.com/alexedwards/flow" "icyphox.sh/legit/config" )@@ -8,6 +10,12 @@ 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")