restful

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 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) Endpoint

func (self *Server) Endpoint(httpMethod string, path string) *endpoint.Endpoint

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(endpointConfig *endpoint.Config, routeDefinition route.Route)

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(endpointConfig *endpoint.Config, handler endpoint.Handler)

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.Configer
	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