Documentation ¶
Index ¶
- func Routes(r chi.Router, db *pg.DB) chi.Router
- type 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)
- func (cw *Handler) UserCtx(next http.Handler) http.Handler
- type UserRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
Handler consists of the DB connection and Routes
func (*Handler) Delete ¶
func (cw *Handler) Delete(w http.ResponseWriter, r *http.Request)
Delete handler deletes a user by the provided {userId}
func (*Handler) Get ¶
func (cw *Handler) Get(w http.ResponseWriter, r *http.Request)
Get handler returns a user by the provided {userId}
func (*Handler) List ¶
func (cw *Handler) List(w http.ResponseWriter, r *http.Request)
List handler returns all users in JSON format.
func (*Handler) Store ¶
func (cw *Handler) Store(w http.ResponseWriter, r *http.Request)
Store handler creates a new user and returns the user in JSON format.
type UserRequest ¶
UserRequest is a pointer to the User model.
Click to show internal directories.
Click to hide internal directories.