http

package
v0.0.0-...-5c0f86f Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: MIT Imports: 13 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 TimeoutMiddleware

func TimeoutMiddleware(next http.Handler) http.Handler

Types

type BookService

type BookService interface {
	PostBook(context.Context, books.Book) (books.Book, error)
	GetBook(ctx context.Context, ID string) (books.Book, error)
	GetAllBooks(ctx context.Context) ([]books.Book, error)
}

type Handler

type Handler struct {
	Router      *mux.Router
	Service     BookService
	Server      *http.Server
	Log         log.Logger
	AuthHandler *auth.Handler
}

func NewHandler

func NewHandler(service BookService, logger log.Logger) *Handler

func (*Handler) GetAllBooks

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

func (*Handler) GetBook

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

func (*Handler) PostBook

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

func (*Handler) Serve

func (h *Handler) Serve() error

type Middlewares

type Middlewares struct {
	log.Logger
}

func NewMiddlewares

func NewMiddlewares(logger log.Logger) *Middlewares

func (*Middlewares) LoggingMiddleware

func (m *Middlewares) LoggingMiddleware(next http.Handler) http.Handler

type PostBookRequest

type PostBookRequest struct {
	Title        string `json:"title" validate:"required"`
	Author       string `json:"author" validate:"required"`
	books.Series `json:"series,omitempty"`
}

type Response

type Response struct {
	Message string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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