server

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFactory = NewFactory()

Default factory instance

View Source
var DefaultLauncher = NewLauncher()

Default launcher instance

Functions

This section is empty.

Types

type Config

type Config struct {
	Root      string
	Port      int
	Version   string
	LogFile   string
	Daemon    bool
	RoutesDir string // Directory for routes (default: "routes")

	// Gzip compression settings
	EnableGzip bool // Enable gzip compression (default: true)
	GzipLevel  int  // Compression level (-1 to 9, -1 = default)

	// Cache settings
	EnableCache bool // Enable compilation cache (default: false)

	// Prebuild settings
	Prebuild         bool // Pre-compile all Svelte components before starting
	PrebuildParallel int  // Number of parallel workers for pre-building
	OnlyPrebuild     bool // Only run prebuild without starting server
}

Config represents server configuration

func NewConfig

func NewConfig() *Config

NewConfig creates a new server configuration

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the server configuration

type ConfigError

type ConfigError struct {
	Message string
	Err     error
}

ConfigError represents a configuration error

func (ConfigError) Error

func (e ConfigError) Error() string

type EmbedConfig

type EmbedConfig struct {
	EmbedFS   fs.FS
	Port      int
	Version   string
	RoutesDir string // Directory for routes (default: "routes")

	// Gzip compression settings
	EnableGzip bool // Enable gzip compression (default: true)
	GzipLevel  int  // Compression level (-1 to 9, -1 = default)

	// Cache settings
	EnableCache bool // Enable compilation cache (default: false)
}

EmbedConfig represents embedded server configuration

func NewEmbedConfig

func NewEmbedConfig(embedFS fs.FS) *EmbedConfig

NewEmbedConfig creates a new embedded server configuration

func (*EmbedConfig) Validate

func (c *EmbedConfig) Validate() error

Validate validates the embedded server configuration

type Factory

type Factory struct{}

Factory creates redi servers with various configurations

func NewFactory

func NewFactory() *Factory

NewFactory creates a new server factory

func (*Factory) CreateEmbeddedServer

func (f *Factory) CreateEmbeddedServer(config *EmbedConfig) (*redi.Server, error)

CreateEmbeddedServer creates an embedded redi server

func (*Factory) CreateServer

func (f *Factory) CreateServer(config *Config) (*redi.Server, error)

CreateServer creates a standard redi server

func (*Factory) CreateServerFromFS

func (f *Factory) CreateServerFromFS(embedFS fs.FS, port int, version string) (*redi.Server, error)

CreateServerFromFS creates a server from a filesystem

func (*Factory) CreateServerFromRoot

func (f *Factory) CreateServerFromRoot(root string, port int, version string) (*redi.Server, error)

CreateServerFromRoot creates a server from a root directory

type Launcher

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

Launcher handles server startup modes

func NewLauncher

func NewLauncher() *Launcher

NewLauncher creates a new server launcher

func (*Launcher) Start

func (l *Launcher) Start(config *Config) error

Start starts the server based on configuration

func (*Launcher) StartEmbedded

func (l *Launcher) StartEmbedded(server *redi.Server) error

StartEmbedded starts an embedded server

func (*Launcher) StartSimple

func (l *Launcher) StartSimple(root string, port int, version string) error

StartSimple starts a server with simple configuration

Jump to

Keyboard shortcuts

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