server

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMode = ProductionMode

DefaultMode is the default mode for the server.

View Source
const ProductionMode = "production"
View Source
const TestingMode = "testing"

Variables

This section is empty.

Functions

func Start

func Start(options Options) (server *webserver.Server, err error)

StartWebServerbserver starts the web server at the specified host and port and listens for incoming requests.

Example:

StartWebServer(Options{
 Host: "localhost",
 Port: "8080",
 Handler: func(w http.ResponseWriter, r *http.Request) {},
 Mode: "production",
})

Parameters: - none

Returns: - none

Types

type LogLevel added in v0.2.0

type LogLevel string

LogLevel represents the level of logging.

const (
	// LogLevelDebug is the debug logging level.
	LogLevelDebug LogLevel = "debug"
	// LogLevelInfo is the info logging level.
	LogLevelInfo LogLevel = "info"
	// LogLevelError is the error logging level.
	LogLevelError LogLevel = "error"
	// LogLevelNone is the none logging level.
	LogLevelNone LogLevel = "none"
)

type Options

type Options struct {
	Host     string
	Port     string
	URL      string // optional, displayed in logs
	Handler  func(w http.ResponseWriter, r *http.Request)
	Mode     string   // optional, default is production, can be development or testing
	LogLevel LogLevel // optional, default is "info", can be "debug", "info", "error", or "none"
}

Options represents the configuration for the web server.

Jump to

Keyboard shortcuts

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