upload page after uploading
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user