diff --git a/main.go b/main.go index 5a67eab..c49d7cb 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "embed" "fmt" + "html/template" "io/fs" "net/http" ) @@ -10,6 +11,9 @@ import ( //go:embed public var public embed.FS +//go:embed templates +var templates embed.FS + func unwrap[T any](output T, err error) T { if err != nil { panic(err) @@ -23,8 +27,10 @@ func handlePost(w http.ResponseWriter, r *http.Request) { if err != nil { fmt.Println(err) } - fmt.Println(r.Form) w.WriteHeader(http.StatusAccepted) + fmt.Println(r.Form) + tmpl, _ := template.ParseFS(templates, "templates/order/confirmation.html") + _ = tmpl.Execute(w, struct{ Status string }{Status: "accepted"}) } func main() { diff --git a/public/new_order.html b/public/new_order.html index 4971f74..f3b9501 100644 --- a/public/new_order.html +++ b/public/new_order.html @@ -1,4 +1,4 @@ -