-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.go
32 lines (26 loc) · 918 Bytes
/
routes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"net/http"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
)
func (app *application) routes() http.Handler {
mux := chi.NewRouter()
fileServer := http.FileServer(http.Dir("./static"))
mux.Use(SessionLoader)
mux.Use(middleware.Logger)
mux.Use(middleware.Recoverer)
mux.Get("/", app.RenderHomePage)
mux.Get("/virtual-terminal", app.VirtualTerminal)
mux.Post("/virtual-terminal-payment-succeeded", app.VirtualTerminalPaymentSucceeded)
mux.Get("/virtual-terminal-receipt", app.VirtualTerminalReceipt)
mux.Post("/payment-succeeded", app.PaymentSucceeded)
mux.Get("/plans/bronze-plan", app.RenderBronzePlan)
mux.Get("/receipt", app.Receipt)
mux.Get("/receipt/bronze", app.BronzePlanReceipt)
mux.Handle("/static/*", http.StripPrefix("/static", fileServer))
mux.Get("/widgets/{id}", app.ChargeOnce)
// auth routes
mux.Get("/login", app.LoginPage)
return mux
}