server

package
v0.0.0-...-26b8db2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder helps to building a web-server

func NewServerBuilder

func NewServerBuilder() *Builder

NewServerBuilder :

func (*Builder) AddHandlerFunc

func (b *Builder) AddHandlerFunc(handler HandlerFunc) *Builder

AddHandlerFunc adds the handler to handler slice handlers in the slice will be executed by on by

func (*Builder) Build

func (b *Builder) Build() Server

Build server

func (*Builder) SetLogFunc

func (b *Builder) SetLogFunc(f LogFunc)

SetLogFunc sets log function

type FileServerOptions

type FileServerOptions struct {
	// Root directory of file server
	// Default : "."
	Root string
	// index filenames of fs
	// Default : []string{"index.html"}
	IndexNames []string
}

FileServerOptions :

type HandlerFunc

type HandlerFunc func(*fasthttp.RequestCtx) bool

HandlerFunc handles reqeust and return bool if it returns true, server stop execution handlers

func NewFileServerHandler

func NewFileServerHandler(opt FileServerOptions) HandlerFunc

NewFileServerHandler :

type LogArguments

type LogArguments struct {
	// Execution time of whole request in milliseconds format
	Time   float32
	Status int
	Method string
	Path   string
}

LogArguments parameter of a log function

type LogFunc

type LogFunc func(args *LogArguments)

LogFunc :

type Server

type Server interface {
	ListenAndServe(addr string) error
}

Server represent eago core server

Jump to

Keyboard shortcuts

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