From 799d0b0cb19d72a31e9d1d3811d893597af25966 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Tue, 28 Jun 2022 00:39:14 +0400 Subject: [PATCH] Removed corresponding ServeStatic paths. Now a single /*filepath is handled. And assets FS should be passed to handlers. --- cmd/dwelling-files/main.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/dwelling-files/main.go b/cmd/dwelling-files/main.go index b199927..b64d8a7 100644 --- a/cmd/dwelling-files/main.go +++ b/cmd/dwelling-files/main.go @@ -3,10 +3,10 @@ package main import ( "dwelling-files/internal/handlers" "dwelling-files/pkg/server" + "dwelling-files/web" "flag" "fmt" "log" - "net/http" "net/netip" "os" "os/signal" @@ -27,12 +27,10 @@ func main() { return } - hand := handlers.New(directoryPath) + hand := handlers.New(directoryPath, web.Assets()) srv := server.NewHttpServer() - srv.ServeStatic("/assets/*filepath", hand.AssetsFS()) - srv.ServeStatic("/file/*filepath", http.Dir(*directoryPath)) - srv.GET("/index/*filepath", hand.Index) + srv.GET("/*filepath", hand.Index) var network string if !strings.ContainsRune(*listenAddress, ':') {