server

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InCtxMiddleware

func InCtxMiddleware(key string, value interface{}) func(http.Handler) http.Handler

InCtxMiddleware allows to specify a key/value that should be set on each request context. This is useful for services that could be used by the handlers.

Types

type Instance

type Instance struct {
	*chi.Mux
	// contains filtered or unexported fields
}

Instance of the server, it contains a router and its basic options, this instance is used to apply options to the server.

func New

func New(name string, options ...Option) *Instance

New sets up and returns a new HTTP server with routes mounted for each of the different features in this application. It also sets up the default middleware for the server.

func (*Instance) Folder

func (r *Instance) Folder(path string, dir fs.FS)

func (*Instance) Start

func (r *Instance) Start() error

type Option

type Option func(*Instance)

Allows to specify options to the server.

func WithHost

func WithHost(host string) Option

WithHost Allows to specify a host for the server to listen on.

func WithPort

func WithPort(port string) Option

WithPort Allows to specify a port for the server to listen on.

Jump to

Keyboard shortcuts

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