# README
webserver
webserver
provides a web server:
- Gracefully handles shutdown
- Applies best practices such as setting up timeouts
- Routing powered by Gorilla Mux
- Logging powered Sypl
- HTTP server powered by Go built-in HTTP server
- Observability is first-class:
- Telemetry powered by Open Telemetry
- Metrics powered by ExpVar
- Built-in useful handlers such as liveness, and readiness
Install
$ go get github.com/saucelabs/webserver
Specific version
Example: $ go get github.com/saucelabs/[email protected]
Usage
See example_test.go
, and webserver_test.go
file.
Documentation
Run $ make doc
or check out online.
Development
Check out CONTRIBUTION.
Release
- Update CHANGELOG accordingly.
- Once changes from MR are merged.
- Tag and release.
Roadmap
Check out CHANGELOG.
# Functions
New returns a basic web server without: - logging - telemetry - metrics - pre-loaded handlers (Liveness, OK, and Stop).
NewDefault returns a web server with observability: - Metrics: `cmdline`, `memstats`, and `server` - Telemetry: `stdout` provider - Logging: `error`, no file - Pre-loaded handlers (Liveness, OK, and Stop) - Versioned router: `/api/v1`.
WithHandlers sets the list of pre-loaded handlers.
WithLogging sets logging configuration.
WithMetrics sets the list of pre-loaded metrics.
WithReadiness sets server readiness.
WithRouter sets the base router.
WithTelemetry sets telemetry.
WithTimeout sets the maximum duration for each individual timeouts.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
ErrRequesTimeout indicates a request failed to finish, it timed out.
# Interfaces
IServer defines what a server does.
# Type aliases
Option allows to define options for the Server.