server

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authorization

func Authorization(uc interfaces.UseCase) func(next http.Handler) http.Handler

Authorization is a middleware to check the token in Authorization header. It returns empty string if the token is not found or invalid.

func Logging

func Logging(next http.Handler) http.Handler

Logging is a middleware to log HTTP access

func MemoryLimit

func MemoryLimit(limit uint64, read ReadMemStatsFn) func(next http.Handler) http.Handler

Types

type Option

type Option func(*serverCfg)

func WithMemoryLimit

func WithMemoryLimit(limit uint64) Option

func WithReadMemStats

func WithReadMemStats(fn ReadMemStatsFn) Option

type ReadMemStatsFn

type ReadMemStatsFn func(m *runtime.MemStats)

type Server

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

func New

func New(uc interfaces.UseCase, options ...Option) *Server

func (*Server) ServeHTTP

func (x *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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