xserver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorHandler

type ErrorHandler func(v ...interface{})

type Middleware

type Middleware struct {
	Handler routing.Handler
	After   bool
}

type RouteDescription

type RouteDescription struct {
	Path       string
	Handler    routing.Handler
	Middleware []Middleware
	Method     string
}

type Server

type Server struct {
	ErrorLogger func(v ...interface{})

	SwaggerSpec string
	Router      *routing.Router
	OnStart     func(router *routing.Router)
	// contains filtered or unexported fields
}

func NewServer

func NewServer(opts *ServerOpts) *Server

NewServer initializes a new Server instance with a middleware handler. middleware represents middleware handler that will be executed before or after the actual handler of each server endpoint.

func (*Server) Start

func (server *Server) Start(port int, routes []RouteDescription) error

func (*Server) Stop

func (server *Server) Stop() error

type ServerOpts

type ServerOpts struct {
	ErrorHandler ErrorHandler
	Middleware   []Middleware
	OnStart      func(router *routing.Router)
}

Jump to

Keyboard shortcuts

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