server

package
v0.0.0-...-c32710b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Graceful

func Graceful(s *http.Server, timeout time.Duration, logger logging.Logger) error

Graceful is used to shutdown a server in a graceful manner

func PrintServerBanner

func PrintServerBanner(name, version, build, env, addr string)

PrintServerBanner put some nice emojis on the console

func ReadConfig

func ReadConfig(envPrefix string, getCfg func() interface{}) (hostname string, port int, basePath string, conf interface{})

ReadConfig parses supplied application parameters and reads the application config file

func Run

func Run(opt RunOptions) (err error)

Run configures and starts the Server

func SetupBasicRouter

func SetupBasicRouter(basePath string, cookieSettings config.ApplicationCookies, corsConfig config.CorsSettings, assets config.AssetSettings, logger logging.Logger) chi.Router

SetupBasicRouter configures typically used middleware components

func SetupSecureAPIRouter

func SetupSecureAPIRouter(errorPath string, jwtOptions config.Security, cookieSettings config.ApplicationCookies, logger logging.Logger) chi.Router

SetupSecureAPIRouter wires the JWT auth for this router

Types

type RunOptions

type RunOptions struct {
	HostName      string
	Port          int
	AppName       string
	Version       string
	Build         string
	Environment   string
	ServerHandler http.Handler
	Logger        logging.Logger
}

RunOptions are used to startup a http.Server

Jump to

Keyboard shortcuts

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