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" "flag"
"fmt" "fmt"
"log" "log"
"net/http"
"net/netip" "net/netip"
"os" "os"
"os/signal" "os/signal"
@ -30,8 +31,8 @@ func main() {
srv := server.NewHttpServer() srv := server.NewHttpServer()
srv.ServeStatic("/assets/*filepath", hand.AssetsFS()) srv.ServeStatic("/assets/*filepath", hand.AssetsFS())
srv.GET("/robots.txt", hand.Robots) srv.ServeStatic("/file/*filepath", http.Dir(*directoryPath))
srv.GET("/*filepath", hand.Index) srv.GET("/index/*filepath", hand.Index)
var network string var network string
if !strings.ContainsRune(*listenAddress, ':') { if !strings.ContainsRune(*listenAddress, ':') {