Removed corresponding ServeStatic paths. Now a single /*filepath is handled.
And assets FS should be passed to handlers.
This commit is contained in:
parent
aec33a154f
commit
799d0b0cb1
@ -3,10 +3,10 @@ package main
|
|||||||
import (
|
import (
|
||||||
"dwelling-files/internal/handlers"
|
"dwelling-files/internal/handlers"
|
||||||
"dwelling-files/pkg/server"
|
"dwelling-files/pkg/server"
|
||||||
|
"dwelling-files/web"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@ -27,12 +27,10 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
hand := handlers.New(directoryPath)
|
hand := handlers.New(directoryPath, web.Assets())
|
||||||
srv := server.NewHttpServer()
|
srv := server.NewHttpServer()
|
||||||
|
|
||||||
srv.ServeStatic("/assets/*filepath", hand.AssetsFS())
|
srv.GET("/*filepath", hand.Index)
|
||||||
srv.ServeStatic("/file/*filepath", http.Dir(*directoryPath))
|
|
||||||
srv.GET("/index/*filepath", hand.Index)
|
|
||||||
|
|
||||||
var network string
|
var network string
|
||||||
if !strings.ContainsRune(*listenAddress, ':') {
|
if !strings.ContainsRune(*listenAddress, ':') {
|
||||||
|
Loading…
Reference in New Issue
Block a user