http

package
v0.0.0-...-a59e774 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONMiddleWare

func JSONMiddleWare(next http.Handler) http.Handler

func JWTAuth

func JWTAuth(
	original func(w http.ResponseWriter, r *http.Request),
) func(w http.ResponseWriter, r *http.Request)

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

func TimeOutMiddleware

func TimeOutMiddleware(next http.Handler) http.Handler

Types

type CommentService

type CommentService interface {
	GetComments(context.Context) ([]comment.Comment, error)
	CreateComment(context.Context, comment.Comment) (comment.Comment, error)
	GetComment(context.Context, string) (comment.Comment, error)
	UpdateComment(context.Context, string, comment.Comment) (comment.Comment, error)
	DeleteComment(context.Context, string) error
}

type CreateCommentDTO

type CreateCommentDTO struct {
	Slug   string `json:"slug" validate:"required"`
	Body   string `json:"body" validate:"required"`
	Author string `json:"author" validate:"required"`
}

type Handler

type Handler struct {
	Router  *mux.Router
	Service CommentService
	Server  http.Server
}

func NewHandler

func NewHandler(service CommentService) *Handler

func (*Handler) CreateComment

func (h *Handler) CreateComment(w http.ResponseWriter, r *http.Request)

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) GetComments

func (h *Handler) GetComments(w http.ResponseWriter, r *http.Request)

func (*Handler) Serve

func (h *Handler) Serve() error

func (*Handler) UpdateComment

func (h *Handler) UpdateComment(w http.ResponseWriter, r *http.Request)

type Response

type Response struct {
	Message string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL