1
0

Set default NotFound handler.

This commit is contained in:
Alexander Andreev 2023-05-25 00:47:32 +04:00
parent 3f79eb5b08
commit dab675474a
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -8,6 +8,7 @@ import (
"flag"
"fmt"
"log"
nethttp "net/http"
"net/netip"
"os"
"os/signal"
@ -88,7 +89,9 @@ func main() {
*keepFileForHours, *limitStorage, *limitFileSize)
srv := http.NewHttpServer()
srv.SetNotFoundHandler(http.NotFound)
srv.SetNotFoundHandler(func(w nethttp.ResponseWriter, r *nethttp.Request) {
http.Error(w, r, nethttp.StatusNotFound, "")
})
srv.ServeStatic("/assets/*filepath", hand.AssetsFS())
srv.GET("/robots.txt", http.RobotsTxt)