Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Static ¶
Static creates static server which can expose env variables in /env handler. Returns svc.Runner
var server = serve.Static( WithAddr("localhost:7777"), WithContent(content, "test-html"), WithExposedEnvVariables("HOME", "SHELL")) err := server()
func StaticHandler ¶
StaticHandler creates static server which can expose env variables in /env. Returns http.handler
func WithCompression ¶
func WithCompression(s *staticServer)
WithCompression instructs server to gzip files
Types ¶
type Option ¶
type Option func(s *staticServer)
Option is an option for static server
func WithContent ¶
WithContent is an option which sets content and it's subdir. Can be used with embed
//go:embed public-html var content embed.FS ... serve.Static(serve.WithContent(content, "public-html"))
func WithExposedEnvVariables ¶
WithExposedEnvVariables is an option which tells the static server to expose environment variable(s)
serve.Static(serve.WithExposedVariables("HOME", "SHELL", "API_ADDR")
func WithIntercept ¶
WithIntercept allows intercept flow with custom function
serve.Static(serve.WithIntercept(myHandlerFn))
Click to show internal directories.
Click to hide internal directories.