22 lines
356 B
Go
22 lines
356 B
Go
|
package add
|
||
|
|
||
|
import (
|
||
|
"github.com/labstack/echo/v4"
|
||
|
"github.com/uptrace/bun"
|
||
|
)
|
||
|
|
||
|
type Handler struct {
|
||
|
db *bun.DB
|
||
|
}
|
||
|
|
||
|
// NewHandler returns new Handler.
|
||
|
func NewHandler(db *bun.DB) *Handler {
|
||
|
return &Handler{db: db}
|
||
|
}
|
||
|
|
||
|
func (h *Handler) Register(g *echo.Group) {
|
||
|
g.GET("", h.AddQuote)
|
||
|
g.POST("", h.AddQuotePost)
|
||
|
g.GET("/success", h.AddQuoteSuccess)
|
||
|
}
|