server

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authorize added in v0.0.15

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 added in v0.0.15

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 added in v0.0.15

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

type Option added in v0.0.15

type Option func(cfg *Server)

func WithAuthzPolicy added in v0.0.15

func WithAuthzPolicy(authz *policy.Client) Option

func WithEnableGraphiQL added in v0.0.15

func WithEnableGraphiQL() Option

func WithEnv added in v0.0.17

func WithEnv(env interfaces.Env) Option

func WithResolver added in v0.0.15

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