Creating a product page
This commit is contained in:
parent
42b8708243
commit
e067b4ba62
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
11
cmd/web/templates/buy-once.page.gohtml
Normal file
11
cmd/web/templates/buy-once.page.gohtml
Normal 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
BIN
static/widget.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 67 KiB |
Loading…
Reference in New Issue
Block a user