server

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

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

Go to latest
Published: Jan 5, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CTX_KEY key = 1

Variables

This section is empty.

Functions

func AuthRequired

func AuthRequired(h http.Handler) http.Handler

func ClaimsFromContext

func ClaimsFromContext(ctx context.Context) (auth.Claims, bool)

func WrapHandler

func WrapHandler(hn func(w http.ResponseWriter, r *http.Request) error) http.HandlerFunc

WrapHandler wraps a modified http.HandlerFunc into a stdlib-compatible one. The inner HandlerFunc additionally returns an error.

Types

type APIError

type APIError struct {
	Code    int
	Message string
}

APIError is an object returned by the API when an error occurs. It implements the error interface and can be returned by handlers.

func (APIError) Error

func (e APIError) Error() string

type Server

type Server struct {
	Router *chi.Mux
	DB     *sql.DB
	Auth   *auth.Verifier
}

func New

func New(c config.Config) (*Server, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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