server

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package server wires the sprite store behind a net/http router that speaks the Sprites REST surface over the /v1 path space. It uses Go 1.22+ method+pattern routing so it needs no third-party router, and is wire-compatible with chant's in-process Sprites fake.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	Error  string `json:"error"`
	Status int    `json:"status,omitempty"`
}

ErrorResponse is the JSON body spritzer returns for any non-2xx status. It carries an "error" message and a machine-readable status.

type Options

type Options struct {
	Version string
	Clock   clock.Clock
	Logger  *slog.Logger
}

Options configures a Server.

type Server

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

Server holds the spritzer state and serves the API.

func New

func New(opts Options) *Server

New constructs a Server, filling in sensible defaults for any zero option.

func (*Server) Handler

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

Handler returns the HTTP handler for the server.

Jump to

Keyboard shortcuts

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