package main import ( "net/http" "github.com/go-chi/chi/v5" ) func (app *application) routes() http.Handler { mux := chi.NewRouter() mux.Use(SessionLoad) mux.Get("/", app.Home) mux.Route("/admin", func(mux chi.Router) { mux.Use(app.Auth) mux.Get("/virtual-terminal", app.VirtualTerminal) mux.Get("/all-sales", app.AllSales) mux.Get("/all-subscriptions", app.AllSubscriptions) mux.Get("/sales/{id}", app.ShowSale) }) // mux.Post("/virtual-terminal-payment-succeeded", app.VirtualTerminalPaymentSucceeded) // mux.Get("/virtual-terminal-receipt", app.VirtualTerminalReceipt) mux.Get("/widget/{id}", app.ChargeOnce) mux.Get("/receipt", app.Receipt) mux.Post("/payment-succeeded", app.PaymentSucceeded) mux.Get("/plans/bronze", app.BronzePlan) mux.Get("/receipt/bronze", app.BronzePlanReceipt) // auth routes mux.Get("/login", app.LoginPage) mux.Post("/login", app.PostLoginPage) mux.Get("/logout", app.Logout) mux.Get("/forgot-password", app.ForgotPassword) mux.Get("/reset-password", app.ShowResetPassword) fileServer := http.FileServer(http.Dir("./static")) mux.Handle("/static/*", http.StripPrefix("/static", fileServer)) return mux }