mirror of
https://github.com/hanzoai/commerce.git
synced 2026-10-30 15:08:42 +00:00
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans, usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0. Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
32 lines
817 B
Go
32 lines
817 B
Go
package form
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/zap-proto/zip"
|
|
|
|
cdn "github.com/hanzoai/commerce/api/cdn/form"
|
|
"github.com/hanzoai/commerce/middleware"
|
|
"github.com/hanzoai/commerce/models/form"
|
|
"github.com/hanzoai/commerce/util/rest"
|
|
)
|
|
|
|
func Route(router *zip.Group, args ...zip.Handler) {
|
|
rest.New(form.Form{}).Route(router, args...)
|
|
|
|
f := router.Group("form")
|
|
f.Use(middleware.AccessControl("*"))
|
|
|
|
f.Raw(http.MethodPost, "/:formid/submit", handleForm)
|
|
f.Raw(http.MethodPost, "/:formid/subscribe", handleForm)
|
|
f.Raw(http.MethodGet, "/:formid/js", cdn.Js)
|
|
|
|
// DEPRECATED
|
|
m := router.Group("mailinglist")
|
|
m.Use(middleware.AccessControl("*"))
|
|
|
|
m.Raw(http.MethodPost, "/:formid/submit", handleForm)
|
|
m.Raw(http.MethodPost, "/:formid/subscribe", handleForm)
|
|
m.Raw(http.MethodGet, "/:formid/js", cdn.Js)
|
|
}
|