goweb

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CorsConfig

type CorsConfig struct {
	AllowOrigins     []string
	AllowMethods     []string
	AllowHeaders     []string
	AllowCredentials bool
	MaxAge           int
}

type JSONConfig added in v0.1.9

type JSONConfig struct {
	Encoder func(v interface{}) ([]byte, error)
	Decoder func(data []byte, v interface{}) error
}

type ProfilingConfig

type ProfilingConfig struct {
	EndpointPrefix string
}

type RateLimiteConfig

type RateLimiteConfig struct {
	MaxRequests         int
	MaxRequestsInterval time.Duration
}

type WebRoute added in v0.1.8

type WebRoute struct {
	Method   string
	Path     string
	Handlers []func(c *fiber.Ctx) error
}

type WebServer

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

func NewWebServer

func NewWebServer(config *WebServerConfig) *WebServer

NewWebServer Creates a new web server based using a given configuration

func (*WebServer) AddRoutes

func (ws *WebServer) AddRoutes(routes ...WebRoute)

AddRoutes Add a new web route

func (*WebServer) GetApp

func (ws *WebServer) GetApp() *fiber.App

GetApp Get the underlying *fiber.App

func (*WebServer) Listen

func (ws *WebServer) Listen(address string) error

Listen Start the web server

type WebServerConfig

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

func DefaultConfig

func DefaultConfig(config WebServerDefaultConfig) *WebServerConfig

DefaultConfig Build the web server default configurations

type WebServerDefaultConfig

type WebServerDefaultConfig struct {
	AppName    string
	Cors       CorsConfig
	Swagger    WebServerSwaggerConfig
	RateLimite RateLimiteConfig
	Profiling  ProfilingConfig
	Logger     WebServerLogger
	JSONConfig JSONConfig
}

type WebServerLogger

type WebServerLogger interface {
	Info(ctx context.Context, message string, opts ...golog.Options)
	Warn(ctx context.Context, message string, opts ...golog.Options)
	Debug(ctx context.Context, message string, opts ...golog.Options)
	Error(ctx context.Context, message string, opts ...golog.Options)
}

type WebServerSwaggerConfig

type WebServerSwaggerConfig struct {
	Title string
	Route string
}

Jump to

Keyboard shortcuts

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