1
0
Fork 0

Removed corresponding ServeStatic paths. Now a single /*filepath is handled.

And assets FS should be passed to handlers.
This commit is contained in:
Alexander Andreev 2022-06-28 00:39:14 +04:00
parent aec33a154f
commit 799d0b0cb1
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F
1 changed files with 3 additions and 5 deletions

View File

@ -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, ':') {