server

package
v0.5.11 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Auth            *auth.Auth
	Cluster         *cluster.Cluster
	Config          *config.Config
	DatabaseManager *database.DatabaseManager
	LogManager      *logs.LogManager
	ServeMux        *netHttp.ServeMux
	// contains filtered or unexported fields
}

func NewApp

func NewApp(configInstance *config.Config, serveMux *netHttp.ServeMux) *App

func (*App) IsInitialized

func (app *App) IsInitialized() bool

func (*App) Run

func (app *App) Run()

type Server

type Server struct {
	HttpServer *http.Server

	PrivatePort     int // Store the actual assigned private port
	PrivateServeMux *http.ServeMux
	PrivateServer   *http.Server
	ServeMux        *http.ServeMux
	// contains filtered or unexported fields
}

func NewServer

func NewServer(c *config.Config) *Server

Create a new Server instance.

func (*Server) GetPrivateAddress added in v0.5.0

func (s *Server) GetPrivateAddress() string

GetPrivateAddress returns the full address of the private server

func (*Server) GetPrivatePort added in v0.5.0

func (s *Server) GetPrivatePort() int

GetPrivatePort returns the actual port number assigned to the private server

func (*Server) OnStarted

func (s *Server) OnStarted(f func()) *Server

OnStarted sets a callback function that is called when the server has successfully started and is ready to accept connections.

func (*Server) Shutdown

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

Shutdown the server instance.

func (*Server) Start

func (s *Server) Start(startHook func(*http.ServeMux), shutdownHook func())

Start the server instance.

func (*Server) StartWithPrivateRouting added in v0.5.0

func (s *Server) StartWithPrivateRouting(
	publicSetup func(*http.ServeMux, *App),
	privateSetup func(*http.ServeMux, *App),
	shutdownHook func(*App),
)

StartWithPrivateRouting starts the server with both public and private servers, automatically setting up the private port provider for cluster communication. This is the recommended way to start a Litebase server.

func (*Server) StartWithPrivateServer added in v0.5.0

func (s *Server) StartWithPrivateServer(startHook func(*http.ServeMux), privateStartHook func(*http.ServeMux), shutdownHook func())

StartWithPrivateServer starts both public and private servers

Jump to

Keyboard shortcuts

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