1
0

Updated ServeStatic and GET file request handler and path.

This commit is contained in:
Alexander Andreev 2022-02-07 04:46:46 +04:00
parent d4e7a7fa25
commit 65ed3ec924
Signed by: Arav
GPG Key ID: 1327FE8A374CC86F

View File

@ -6,6 +6,7 @@ import (
"dwelling-upload/pkg/server" "dwelling-upload/pkg/server"
"flag" "flag"
"log" "log"
"net/http"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
@ -25,11 +26,11 @@ func main() {
srv := server.NewHttpServer() srv := server.NewHttpServer()
srv.ServeStatic("/assets/*filepath", handlers.StaticAssets()) srv.ServeStatic("/assets/*filepath", http.Dir(config.WebDir+"/assets"))
srv.GET("/", hand.Index) srv.GET("/", hand.Index)
srv.POST("/", hand.Upload) srv.POST("/", hand.Upload)
srv.GET("/:hash/:name", hand.Upload) srv.GET("/f/:hash/:name", hand.Download)
if err := srv.Start(config.SplitNetworkAddress()); err != nil { if err := srv.Start(config.SplitNetworkAddress()); err != nil {
log.Fatalln(err) log.Fatalln(err)