udemy-go-web-2/cmd/web/routes.go

21 lines
421 B
Go

package main
import (
"net/http"
"github.com/go-chi/chi/v5"
)
func (app *application) routes() http.Handler {
mux := chi.NewRouter()
mux.Get("/virtual-terminal", app.VirtualTerminal)
mux.Post("/payment-succeeded", app.PaymentSucceeded)
mux.Get("/widget/{id}", app.ChargeOnce)
fileServer := http.FileServer(http.Dir("./static"))
mux.Handle("/static/*", http.StripPrefix("/static", fileServer))
return mux
}