http_server

package
v0.0.0-...-592584e Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chain

func Chain(f http.HandlerFunc, middlewares ...Middleware) http.HandlerFunc

Chain applies middlewares to a http.HandlerFunc

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func NewApp

func NewApp(logger *slog.Logger,
	paymentUseCase contract.PaymentUseCase,
	orderUseCase contract.OrderUseCase,
) *App

func (*App) Run

func (e *App) Run(ctx context.Context) error

type Middleware

type Middleware func(http.HandlerFunc) http.HandlerFunc

func Logging

func Logging() Middleware

Logging logs all requests with its path and the time it took to process

func Method

func Method(m string) Middleware

Method ensures that url can only be requested with a specific method, else returns a 400 Bad Request

Jump to

Keyboard shortcuts

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