restful

package
v0.0.9-generics Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server listens for incoming requests and routes them to the registered endpoint handlers.

func NewServer

func NewServer(serverConfig *ServerConfig) *Server

NewServer sets up a new server.

func (Server) Execute

func (self Server) Execute(fasthttpCtx *fasthttp.RequestCtx) (int, []byte)

Execute one request. Useful for testing.

func (*Server) Handle

func (self *Server) Handle(httpMethod string, path string, handle *handler.Handle)

Handle the given route to the provided endpoint handler. This starts a builder pattern where the endpoint may be modified from the root endpoint configuration.

func (*Server) HandleNotFound

func (self *Server) HandleNotFound(handle *handler.Handle)

func (*Server) Handler

func (self *Server) Handler(httpMethod string, path string) *handler.Runner

func (Server) Listen

func (self Server) Listen()

Listen for incoming requests. This is a blocking call. It will not return until after the server as received a shutdown

signal and has drained all running requests.

type ServerConfig

type ServerConfig struct {
	Host           string
	Port           int
	ReadTimeout    time.Duration
	WriteTimeout   time.Duration
	LogConfig      log.LoggerConfig
	MaxConcurrency int
	EnablePprof    bool
}

ServerConfig top level options. These options can be altered per endpoint, if desired.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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