package route import ( "forge.cadoles.com/Cadoles/fake-sms/internal/config" "github.com/go-chi/chi" "gitlab.com/wpetit/goweb/static" ) func Mount(r *chi.Mux, config *config.Config) error { r.Group(func(r chi.Router) { r.Get("/", serveOutboxPage) r.Delete("/sms", handleClearOutbox) r.Get("/sms/{id}", serveSMSPage) r.Delete("/sms/{id}", handleSMSDelete) }) r.Route("/api", func(r chi.Router) { r.Route("/v1", func(r chi.Router) { r.Get("/sms", browseAPIV1SMS) r.Get("/sms/{id}", serveAPIV1SMS) }) }) notFoundHandler := r.NotFoundHandler() r.Get("/*", static.Dir(config.HTTP.PublicDir, "", notFoundHandler)) return nil }