web

package
v0.0.0-...-2040d2c Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blob

func Blob[T ~[]byte | ~string](body T, contentType string, status int) http.HandlerFunc

func JSON

func JSON(value any, status int) http.HandlerFunc

func Redirect

func Redirect(to string, permanent ...bool) http.HandlerFunc

func Serve

func Serve(ctx context.Context, options ServeOption) (port uint16, err error)

func UseBasicAuth

func UseBasicAuth(r Router, username, password string)

UseBasicAuth implements a simple middleware handler for adding basic http auth to a route.

Types

type Router

type Router = chi.Router

func NewMux

func NewMux() Router

type ServeOption

type ServeOption struct {
	Handler    http.Handler
	Addr       string
	OnShutDown func(ctx context.Context)
}

Jump to

Keyboard shortcuts

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