server

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAppNil = errors.New("app is nil")
)

Functions

This section is empty.

Types

type Context added in v0.0.5

type Context interface {
	fiber.Ctx
	// JSONResponse is the function that used to send json response.
	JSONResponse(data interface{}, val error) error
}

type Option

type Option interface {
	Apply(svc *Server) error
}

func WithAppConfig added in v0.0.3

func WithAppConfig(config fiber.Config) Option

func WithMiddlewares

func WithMiddlewares(middlewares ...fiber.Handler) Option

WithMiddlewares is the option that adds middlewares to the server.

Example:

WithMiddlewares(middleware.WithRecover())

func WithPostHook added in v0.0.3

func WithPostHook(hook ...fiber.OnShutdownHandler) Option

type Server

type Server struct {
	// Legacy attribute for fiber app
	*fiber.App
	// contains filtered or unexported fields
}

Server is a struct to handle server

func New

func New(serverName string, opt ...Option) (*Server, error)

New creates a new server Basically, it creates a new fiber app with the given config

func NewWithDefaultConfig

func NewWithDefaultConfig(serverName string, mask *mask.Mask, opt ...Option) (*Server, error)

NewWithDefaultConfig creates a new server with default config This config choosen by the author of the package

func (*Server) Listen

func (s *Server) Listen(address string, config ...fiber.ListenConfig) error

Listen starts the server with the given address and config It will shutdown the server gracefully when os.Interrupt, syscall.SIGTERM, or syscall.SIGQUIT signal is received It will return error if the server failed to start

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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