Documentation
¶
Index ¶
- func JSONMiddleware(next http.Handler) http.Handler
- func JWTAuth(original func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request)
- func LoggingMiddleware(next http.Handler) http.Handler
- func TimeoutMiddleware(next http.Handler) http.Handler
- type CommentService
- type Handler
- func (h *Handler) DeleteComment(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetComment(w http.ResponseWriter, r *http.Request)
- func (h *Handler) PostComment(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Serve() error
- func (h *Handler) UpdateComment(w http.ResponseWriter, r *http.Request)
- type PostCommentRequest
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JWTAuth ¶
func JWTAuth( original func(w http.ResponseWriter, r *http.Request), ) func(w http.ResponseWriter, r *http.Request)
Types ¶
type CommentService ¶
type CommentService interface { PostComment(context.Context, comment.Comment) (comment.Comment, error) GetComment(ctx context.Context, ID string) (comment.Comment, error) UpdateComment(ctx context.Context, ID string, newCmt comment.Comment) (comment.Comment, error) DeleteComment(ctx context.Context, ID string) error }
type Handler ¶
type Handler struct { Router *mux.Router Service CommentService Server *http.Server }
func NewHandler ¶
func NewHandler(service CommentService) *Handler
func (*Handler) DeleteComment ¶
func (h *Handler) DeleteComment(w http.ResponseWriter, r *http.Request)
func (*Handler) GetComment ¶
func (h *Handler) GetComment(w http.ResponseWriter, r *http.Request)
func (*Handler) PostComment ¶
func (h *Handler) PostComment(w http.ResponseWriter, r *http.Request)
func (*Handler) UpdateComment ¶
func (h *Handler) UpdateComment(w http.ResponseWriter, r *http.Request)
type PostCommentRequest ¶
Click to show internal directories.
Click to hide internal directories.