riverui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

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

Middleware wraps River UI handler into standard Go HTTP middleware

func NewMiddleware

func NewMiddleware(ctx context.Context, opts Options) (*Middleware, error)

NewMiddleware makes River UI middleware with given options

func (*Middleware) RiverUI

func (m *Middleware) RiverUI(next http.Handler) http.Handler

RiverUI middleware serves River UI endpoints on matching paths

type Options

type Options struct {
	// RiverClient is provided to initialize ui endpoints
	RiverClient *river.Client[pgx.Tx]

	// EndpointsTx is an optional transaction to wrap all database operations for api endpoints.
	// It's mainly used for testing.
	EndpointsTx *pgx.Tx

	// DevMode is whether the server is running in development mode
	DevMode bool

	// LiveFS is whether to use the live filesystem for the frontend.
	// This flag requires RIVER_UI_PROJECT_ROOT environment variable to be set.
	LiveFS bool

	// Logger is the logger to use logging errors within the handler
	Logger *slog.Logger

	// BaseURL is the path for reverse proxy (e.g. "/riverui")
	BaseURL string
}

Options contains options for creating River UI middleware

Jump to

Keyboard shortcuts

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