fiber

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PluginsRoot = root + ".plugins"
)

Variables

This section is empty.

Functions

func ConfigAdd

func ConfigAdd(path string)

Types

type AppPlugin

type AppPlugin func(context.Context, *fiber.App) error

AppPlugin defines a AppPlugin function signature.

type ConfigPlugin

type ConfigPlugin func(context.Context, *fiber.Config) error

ConfigPlugin defines a ConfigPlugin function signature.

type Options

type Options struct {
	Port   int
	Type   string
	Config *fiber.Config
}

Options represents fiber server options

type Plugin

type Plugin func(context.Context, *Options) (ConfigPlugin, AppPlugin)

Plugin defines a Plugin function signature.

type Server

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

Server represents a fiber server.

func NewServer

func NewServer(ctx context.Context, plugins ...Plugin) *Server

NewServer new fiber server with default options.

func NewServerWithConfigPath

func NewServerWithConfigPath(ctx context.Context, path string, plugins ...Plugin) (*Server, error)

NewServerWithConfigPath new fiber server with options from config path.

func NewServerWithOptions

func NewServerWithOptions(ctx context.Context, options *Options, plugins ...Plugin) *Server

NewServerWithOptions new fiber server with options.

func (*Server) Add

func (s *Server) Add(method string, path string, handlers ...fiber.Handler) fiber.Router

Add registers handlers for method at path

func (*Server) All

func (s *Server) All(path string, handlers ...fiber.Handler) fiber.Router

All registers handlers for all methods at path.

func (*Server) App

func (s *Server) App() *fiber.App

App returns fiber app instance.

func (*Server) Connect

func (s *Server) Connect(path string, handlers ...fiber.Handler) fiber.Router

Connect registers a route for CONNECT methods that establishes a tunnel to the server identified by the target resource.

func (*Server) Delete

func (s *Server) Delete(path string, handlers ...fiber.Handler) fiber.Router

Delete registers handlers for method DELETE at path.

func (*Server) Get

func (s *Server) Get(path string, handlers ...fiber.Handler) fiber.Router

Get registers handlers for method GET at path.

func (*Server) Group

func (s *Server) Group(path string, handlers ...fiber.Handler) fiber.Router

Group is used for Routes with common prefix to define a new sub-router with optional middleware.

api := app.Group("/api")
api.Get("/users", handler)

func (*Server) Head

func (s *Server) Head(path string, handlers ...fiber.Handler) fiber.Router

Head registers handlers for method HEAD at path.

func (*Server) Options

func (s *Server) Options(path string, handlers ...fiber.Handler) fiber.Router

Options registers handlers for OPTION method at path.

func (*Server) Patch

func (s *Server) Patch(path string, handlers ...fiber.Handler) fiber.Router

Patch registers handlers for method PATCH at path.

func (*Server) Post

func (s *Server) Post(path string, handlers ...fiber.Handler) fiber.Router

Post registers handlers for method POST at path.

func (*Server) Put

func (s *Server) Put(path string, handlers ...fiber.Handler) fiber.Router

Put registers handlers for method PUT at path.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context)

Serve starts app to serve at specified address.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context)

Shutdown shut server down gracefully.

Jump to

Keyboard shortcuts

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