server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package server exposes the GraphQL API over HTTP: POST /graphql, an embedded GraphiQL page, and health endpoints. The schema is swappable at runtime (watch mode): requests in flight keep the schema they started with.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

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

Authenticator turns an HTTP request into (claims, role) per the configured claim source: verified JWT, trusted gateway headers, or none.

func NewAuthenticator

func NewAuthenticator(cfg config.RLS) *Authenticator

func (*Authenticator) Authenticate

func (a *Authenticator) Authenticate(r *http.Request) (map[string]any, string, error)

Authenticate never fails open: a present-but-invalid credential is an error; an absent credential yields the anonymous role.

type Server

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

Server is the HTTP front end. Executor is stored atomically so watch mode can swap in a new schema without a restart.

func New

func New(cfg config.Server, auth *Authenticator, ex *exec.Executor, sdl string, log *slog.Logger) (*Server, error)

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the HTTP mux.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(ctx context.Context) error

ListenAndServe runs the server until ctx is cancelled.

func (*Server) Swap

func (s *Server) Swap(ex *exec.Executor, sdl string)

Swap atomically replaces the executor (and SDL) — watch mode.

Jump to

Keyboard shortcuts

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