webserver

package
v0.0.0-...-e92e447 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 16 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 ProfilingConfig

type ProfilingConfig struct {
	EndpointPrefix string
}

type RateLimiteConfig

type RateLimiteConfig struct {
	MaxRequests         int
	MaxRequestsInterval time.Duration
}

type WebRouter

type WebRouter interface {
	Start()
}

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 ...WebRouter)

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
}

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