2024-08-03 10:17:39 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (app *application) routes() http.Handler {
|
|
|
|
mux := chi.NewRouter()
|
2024-08-10 09:10:27 +00:00
|
|
|
mux.Use(SessionLoad)
|
2024-08-03 19:57:24 +00:00
|
|
|
|
2024-08-10 09:10:27 +00:00
|
|
|
mux.Get("/", app.Home)
|
2024-08-20 19:45:13 +00:00
|
|
|
|
|
|
|
mux.Route("/admin", func(mux chi.Router) {
|
|
|
|
mux.Use(app.Auth)
|
|
|
|
mux.Get("/virtual-terminal", app.VirtualTerminal)
|
|
|
|
})
|
|
|
|
|
|
|
|
// mux.Post("/virtual-terminal-payment-succeeded", app.VirtualTerminalPaymentSucceeded)
|
|
|
|
// mux.Get("/virtual-terminal-receipt", app.VirtualTerminalReceipt)
|
2024-08-11 10:30:57 +00:00
|
|
|
|
2024-08-07 09:56:53 +00:00
|
|
|
mux.Get("/widget/{id}", app.ChargeOnce)
|
2024-08-11 10:30:57 +00:00
|
|
|
mux.Get("/receipt", app.Receipt)
|
|
|
|
mux.Post("/payment-succeeded", app.PaymentSucceeded)
|
2024-08-06 11:29:32 +00:00
|
|
|
|
2024-08-11 20:08:55 +00:00
|
|
|
mux.Get("/plans/bronze", app.BronzePlan)
|
2024-08-12 17:23:44 +00:00
|
|
|
mux.Get("/receipt/bronze", app.BronzePlanReceipt)
|
2024-08-11 20:08:55 +00:00
|
|
|
|
2024-08-12 19:38:12 +00:00
|
|
|
// auth routes
|
|
|
|
mux.Get("/login", app.LoginPage)
|
2024-08-20 19:45:13 +00:00
|
|
|
mux.Post("/login", app.PostLoginPage)
|
|
|
|
mux.Get("/logout", app.Logout)
|
2024-08-20 20:06:04 +00:00
|
|
|
mux.Get("/forgot-password", app.ForgotPassword)
|
2024-08-12 19:38:12 +00:00
|
|
|
|
2024-08-06 11:29:32 +00:00
|
|
|
fileServer := http.FileServer(http.Dir("./static"))
|
|
|
|
mux.Handle("/static/*", http.StripPrefix("/static", fileServer))
|
2024-08-03 19:57:24 +00:00
|
|
|
|
2024-08-03 10:17:39 +00:00
|
|
|
return mux
|
|
|
|
}
|