Creating a product page

This commit is contained in:
vinchent 2024-08-06 13:29:32 +02:00
parent 42b8708243
commit e067b4ba62
4 changed files with 22 additions and 0 deletions

View File

@ -43,3 +43,10 @@ func (app *application) PaymentSucceeded(w http.ResponseWriter, r *http.Request)
app.errorLog.Println(err)
}
}
// ChargeOnce displays the page to buy one widget
func (app *application) ChargeOnce(w http.ResponseWriter, r *http.Request) {
if err := app.renderTemplate(w, r, "buy-once", nil); err != nil {
app.errorLog.Println(err)
}
}

View File

@ -11,6 +11,10 @@ func (app *application) routes() http.Handler {
mux.Get("/virtual-terminal", app.VirtualTerminal)
mux.Post("/payment-succeeded", app.PaymentSucceeded)
mux.Get("/charge-once", app.ChargeOnce)
fileServer := http.FileServer(http.Dir("./static"))
mux.Handle("/static/*", http.StripPrefix("/static", fileServer))
return mux
}

View File

@ -0,0 +1,11 @@
{{ template "base" }}
{{ define "title" }}
Buy one widget
{{ end }}
{{ define "content" }}
<h2 class="mt-3 text-center">Buy One Widget</h2>
<hr>
<img src="/static/widget.jpeg"
alt="widget"
class="image-fluid rounded mx-auto d-block">
{{ end }}

BIN
static/widget.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB