http

package
v2.0.8 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBody

func ParseBody(c *fiber.Ctx, v validation.Validator, i i18np.I18n, d interface{})

ParseBody parses the request body into the given struct and validates it.

func ParseParams

func ParseParams(c *fiber.Ctx, v validation.Validator, i i18np.I18n, d interface{})

ParseParams parses the request params into the given struct and validates it.

func ParseQuery

func ParseQuery(c *fiber.Ctx, v validation.Validator, i i18np.I18n, d interface{})

ParseQuery parses the request query into the given struct and validates it.

func RunServer

func RunServer(cfg Config) error

RunServer runs a server with the given configuration. It returns an error if the server fails to start. If the logger is nil, it will use the default logger.

func RunServerOnAddr

func RunServerOnAddr(addr string, cfg Config) error

Types

type Config

type Config struct {
	Host           string
	Port           int
	Group          string
	AppName        string
	CreateHandler  func(router fiber.Router) fiber.Router
	I18n           *i18np.I18n
	AcceptLangs    []string
	BodyLimit      int
	ReadBufferSize int
	Debug          bool
	Logger         log.Service
}

type ErrorHandler

type ErrorHandler func(c *fiber.Ctx, err error) error

func NewErrorHandler

func NewErrorHandler(logger log.Service, translator *i18np.I18n) ErrorHandler

Jump to

Keyboard shortcuts

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