server

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIServerContext

type APIServerContext struct {
	// The API server instance. This is a Fiber app that you extend with your routes and middleware. You can also access it to add custom routes or middleware if needed.
	App *fiber.App
	// NATS context holds the NATS connection and JetStream context. You can use this to publish messages to NATS or manage streams.
	NatsContext *utils.NatsContext
	// ETCD client for interacting with the ETCD datastore. You can use this to read/write data to ETCD directly if needed.
	ETCD *utils.EtcdClient
	// LogModel is a wrapper around BadgerDB for storing logs. You can use this to write logs to the database.
	LogModel *models.LogModel
	// BadgerDB instance for direct access to the database if needed. You can use this for advanced queries or operations that are not covered by the LogModel.
	BadgerDB *badger.DB
	// Config holds the server configuration. You can access this to read any configuration values that were used to set up the server. This can be useful if you want to make decisions based on the configuration at runtime.
	Config *types.ServerConfig
}

APIServerContext holds references to the API server and its dependencies. You can call Start() on the APIServerContext to run the server, and ShutDown() to gracefully stop it.

func Setup

func Setup(config *types.ServerConfig) (APIServerContext, error)

Setup the API server with all routes and dependencies. It returns an APIServerContext which holds references to the server. You can later call Start() on the APIServerContext to run the server.

func (*APIServerContext) ShutDown

func (c *APIServerContext) ShutDown()

Graceful shutdown of server and dependencies

func (*APIServerContext) Start

func (appCtx *APIServerContext) Start()

Start the API server and all dependencies. This function will block until an interrupt signal is received, at which point it will attempt to gracefully shut down the server and dependencies.

Jump to

Keyboard shortcuts

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