server

package
v0.4.0 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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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