httpapi

package
v0.2.12 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(router gin.IRouter, handlers *core.Handlers, noRoute ...gin.HandlerFunc)

RegisterRoutes registers the shared daemon API routes on the supplied router.

Types

type Option

type Option func(*Server)

Option customizes HTTP server construction.

func WithDevProxyTarget

func WithDevProxyTarget(target string) Option

WithDevProxyTarget enables development fallback proxying to a Vite server.

func WithEngine

func WithEngine(engine *gin.Engine) Option

WithEngine overrides the Gin engine used by the server.

func WithHandlers

func WithHandlers(handlers *core.Handlers) Option

WithHandlers injects the shared transport handlers.

func WithHost

func WithHost(host string) Option

WithHost overrides the HTTP bind host.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger injects the server logger.

func WithPort

func WithPort(port int) Option

WithPort overrides the HTTP bind port.

func WithPortUpdater

func WithPortUpdater(updater PortUpdater) Option

WithPortUpdater persists the selected port after the listener binds.

type PortUpdater

type PortUpdater interface {
	SetHTTPPort(context.Context, int) error
}

PortUpdater persists the selected HTTP port in daemon state.

type Server

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

Server exposes the daemon API over localhost HTTP.

func New

func New(opts ...Option) (*Server, error)

New constructs a localhost HTTP API server.

func (*Server) Port

func (s *Server) Port() int

Port reports the effective HTTP port.

func (*Server) Shutdown

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

Shutdown stops accepting new requests and drains active ones.

func (*Server) Start

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

Start begins serving the API over localhost TCP.

Jump to

Keyboard shortcuts

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