diff options
Diffstat (limited to 'pkg/handler/quote/handler.go')
-rw-r--r-- | pkg/handler/quote/handler.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/pkg/handler/quote/handler.go b/pkg/handler/quote/handler.go new file mode 100644 index 0000000..04807c0 --- /dev/null +++ b/pkg/handler/quote/handler.go @@ -0,0 +1,26 @@ +package quote + +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.Index) + g.GET("quote/:id", h.Quote) + g.GET("random", h.Random) + g.GET("top", h.Top) +} + +type Pagination struct { + Page int `query:"page" default:"0"` +} |