upload page after uploading

This commit is contained in:
2026-11-12 21:14:41 -05:00
parent 59c156f6ac
commit 350bf1842f
7 changed files with 118 additions and 15 deletions
+9 -2
View File
@@ -5,6 +5,7 @@ import (
"log"
"net/http"
"os"
"strings"
)
func main() {
@@ -27,7 +28,13 @@ func main() {
log.Fatal(err)
}
pages, err := template.ParseFiles("templates/home.html", "templates/header.html")
pages, err := template.New("").Funcs(template.FuncMap{
"hasPrefix": strings.HasPrefix,
}).ParseFiles(
"templates/home.html",
"templates/header.html",
"templates/upload.html",
)
if err != nil {
log.Fatal(err)
}
@@ -49,7 +56,7 @@ func main() {
}
})
mux.HandleFunc("GET /{id}", contentHandler(db, config))
mux.HandleFunc("POST /upload", uploadHandler(db, config))
mux.HandleFunc("POST /upload", uploadHandler(db, config, pages))
mux.HandleFunc("DELETE /{id}", deleteHandler(db, config))
mux.HandleFunc("POST /{id}/delete", deleteHandler(db, config))
mux.HandleFunc("GET /health", health)