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 ¶
This section is empty.
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.
type Server ¶ added in v0.10.0
func Start ¶
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
Click to show internal directories.
Click to hide internal directories.