Documentation ¶
Index ¶
- func Routes(r chi.Router, db *pg.DB) chi.Router
- type CategoryRequest
- type Handler
- func (cw *Handler) CategoryCtx(next http.Handler) http.Handler
- func (cw *Handler) Delete(w http.ResponseWriter, r *http.Request)
- func (cw *Handler) Get(w http.ResponseWriter, r *http.Request)
- func (cw *Handler) List(w http.ResponseWriter, r *http.Request)
- func (cw *Handler) Store(w http.ResponseWriter, r *http.Request)
- func (cw *Handler) Update(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CategoryRequest ¶
CategoryRequest is a pointer to the Category model.
type Handler ¶
Handler consists of the DB connection and Routes
func (*Handler) CategoryCtx ¶
CategoryCtx handler loads a category by either {categoryId} or {categorySlug}
func (*Handler) Delete ¶
func (cw *Handler) Delete(w http.ResponseWriter, r *http.Request)
Delete handler deletes a category by the provided {categoryId}
func (*Handler) Get ¶
func (cw *Handler) Get(w http.ResponseWriter, r *http.Request)
Get handler returns a category by the provided {categoryId}
func (*Handler) List ¶
func (cw *Handler) List(w http.ResponseWriter, r *http.Request)
List handler returns all categories in JSON format.
Click to show internal directories.
Click to hide internal directories.