1
0

Because of how httprouter works I had to create an /index/ endpoint. Also /file/ endpoint serving files was added.

This commit is contained in:
Alexander Andreev 2022-06-27 22:53:02 +04:00
parent a2a40a6dfe
commit feda955c38
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

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