server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BrowserTestCORSMiddleware

func BrowserTestCORSMiddleware(next http.Handler) http.Handler

BrowserTestCORSMiddleware keeps the example server usable from browser-based demos. It is intentionally permissive because this binary is a local sample server.

func InitializeApplicationTables

func InitializeApplicationTables(ctx context.Context, pool *pgxpool.Pool, logger *slog.Logger) error

InitializeApplicationTables creates `business` schema + business tables.

func LoggingMiddleware

func LoggingMiddleware(enable bool, next http.Handler, logger *slog.Logger) http.Handler

LoggingMiddleware logs request/response bodies for development

Types

type ServerComponents

type ServerComponents struct {
	Pool        *pgxpool.Pool
	SyncService *oversync.SyncService
	Auth        *exampleauth.TokenAuth
	Handler     http.Handler
	Logger      *slog.Logger
	// contains filtered or unexported fields
}

func SetupServer

func SetupServer(config *ServerConfig) (*ServerComponents, error)

func (*ServerComponents) Close

func (sc *ServerComponents) Close()

type ServerConfig

type ServerConfig struct {
	DatabaseURL string
	JWTSecret   string
	Logger      *slog.Logger
	AppName     string
}

Jump to

Keyboard shortcuts

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