http

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RouterCallBack

type RouterCallBack func(router chi.Router)

RouterCallBack

type Server

type Server interface {
	Flush() error
	ListenAndServe() error
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

func NewServer

func NewServer(options ...ServerOptionFunc) (Server, error)

type ServerOptionFunc

type ServerOptionFunc func(*server) error

ServerOptionFunc is a function that configures a Server. It is used in NewServer.

func SetBuildInfo

func SetBuildInfo(info *c.BuildVersionInfo) ServerOptionFunc

SetBuildInfo adds a version handler for showing build information at '/version'.

func SetIntroSpection

func SetIntroSpection(enabled bool) ServerOptionFunc

SetIntroSpection enables introspection handlers.

func SetPort

func SetPort(port int) ServerOptionFunc

SetPort sets the port on which the server will listen to TCP traffic.

func SetRouters

func SetRouters(rb ...RouterCallBack) ServerOptionFunc

SetRouters adds all HTTP routes for the server.

func SetStaticAssets

func SetStaticAssets(assets http.FileSystem) ServerOptionFunc

SetStaticAssets registers static assets to be used as middleware.

Directories

Path Synopsis
assets.FileSystem can be used as any other http.FileSystem in your program, for example http.Handle("/assets", http.FileServer(assets.FileSystem)) You must run 'go generate ./...' to update the contents of the assets.
assets.FileSystem can be used as any other http.FileSystem in your program, for example http.Handle("/assets", http.FileServer(assets.FileSystem)) You must run 'go generate ./...' to update the contents of the assets.

Jump to

Keyboard shortcuts

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