This commit is contained in:
bronku 2026-11-08 20:09:06 +01:00
parent de22166113
commit 6963a88602
5 changed files with 129 additions and 17 deletions

14
main.go
View file

@ -207,9 +207,15 @@ func main() {
if len(os.Args) > 1 {
return
}
server := http.ServeMux{}
server.Handle("/", http.FileServer(http.Dir("www")))
server.HandleFunc("POST /order/", orders.OrderHandler)
orders.InitStripe(os.Getenv("STRIPE_SECRET_KEY"))
mux := http.ServeMux{}
mux.Handle("/", http.FileServer(http.Dir("www")))
mux.HandleFunc("POST /order/", orders.OrderHandler)
mux.HandleFunc("POST /webhook", orders.WebhookHandler(os.Getenv("STRIPE_WEBHOOK_SECRET")))
log.Println("listening on :8000")
log.Fatal(http.ListenAndServe(":8000", &server))
log.Fatal(http.ListenAndServe(":8000", &mux))
}