fake-sms/internal/route/mount.go

34 lines
721 B
Go

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)
// Powow Mock
r.Post("/mock/powow", handlePowowEntrypoint)
})
})
notFoundHandler := r.NotFoundHandler()
r.Get("/*", static.Dir(config.HTTP.PublicDir, "", notFoundHandler))
return nil
}