This commit is contained in:
bronku 2026-11-09 16:29:52 +01:00
parent 6185a59de9
commit 9e16843a29
8 changed files with 178 additions and 123 deletions

View file

@ -210,13 +210,11 @@ func main() {
return
}
orders.InitStripe(os.Getenv("STRIPE_SECRET_KEY"))
mux := http.ServeMux{}
mux.Handle("/", http.FileServer(http.Dir("www")))
mux.Handle("POST /order", orders.Limit(http.HandlerFunc(orders.OrderHandler), 10*time.Second, 5))
mux.HandleFunc("POST /webhook", orders.WebhookHandler(os.Getenv("STRIPE_WEBHOOK_SECRET")))
mux.HandleFunc("POST /webhook", orders.WebhookHandler)
log.Println("listening on :8000")
log.Fatal(http.ListenAndServe(":8000", &mux))