Help us shape the future of Go! Take the 2026 Go Developer Survey

server

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authorize

func Authorize(authz *policy.Client, getEnv interfaces.Env) func(next http.Handler) http.Handler

func Logging

func Logging(next http.Handler) http.Handler

Types

type HTTPAuthzInput

type HTTPAuthzInput struct {
	Method string              `json:"method"`
	Path   string              `json:"path"`
	Query  url.Values          `json:"query"`
	Header map[string][]string `json:"header"`
	Remote string              `json:"remote"`
	Body   string              `json:"body"`
	Env    types.EnvVars       `json:"env"`
}

type HTTPAuthzOutput

type HTTPAuthzOutput struct {
	Deny bool `json:"deny"`
}

type Option

type Option func(cfg *Server)

func WithAuthzPolicy

func WithAuthzPolicy(authz *policy.Client) Option

func WithEnableGraphiQL

func WithEnableGraphiQL() Option

func WithEnv

func WithEnv(env interfaces.Env) Option

func WithResolver

func WithResolver(resolver *graphql.Resolver) Option

type Server

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

func New

func New(hdlr interfaces.AlertHandler, options ...Option) *Server

func (*Server) Run

func (x *Server) Run(addr string) error

func (*Server) ServeHTTP

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

type StatusCodeWriter

type StatusCodeWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func (*StatusCodeWriter) WriteHeader

func (x *StatusCodeWriter) WriteHeader(code int)

Jump to

Keyboard shortcuts

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