From feda955c388dcf1d9a9d276557b88d4b4806893d Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 27 Jun 2022 22:53:02 +0400 Subject: [PATCH] Because of how httprouter works I had to create an /index/ endpoint. Also /file/ endpoint serving files was added. --- cmd/dwelling-files/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/dwelling-files/main.go b/cmd/dwelling-files/main.go index 9620fea..b199927 100644 --- a/cmd/dwelling-files/main.go +++ b/cmd/dwelling-files/main.go @@ -6,6 +6,7 @@ import ( "flag" "fmt" "log" + "net/http" "net/netip" "os" "os/signal" @@ -30,8 +31,8 @@ func main() { srv := server.NewHttpServer() srv.ServeStatic("/assets/*filepath", hand.AssetsFS()) - srv.GET("/robots.txt", hand.Robots) - srv.GET("/*filepath", hand.Index) + srv.ServeStatic("/file/*filepath", http.Dir(*directoryPath)) + srv.GET("/index/*filepath", hand.Index) var network string if !strings.ContainsRune(*listenAddress, ':') {