serverfiber

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: MIT Imports: 5 Imported by: 0

README

go-server-fiber

Fiber servers for go-services

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FiberConfig

type FiberConfig struct {
	BindAddress string
}

FiberConfig is the in-memory implementation of the ServerFiberConfig.

func (*FiberConfig) GetBindAddress

func (config *FiberConfig) GetBindAddress() string

type FiberServer

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

FiberServer represents the services.Server for fiber applications.

func NewFiberServer

func NewFiberServer(config ServerFiberConfig, initializer Initializer) *FiberServer

NewFiberServer returns a new instance of FiberServer initialized.

func (*FiberServer) Close

func (server *FiberServer) Close(_ context.Context) error

func (*FiberServer) Listen

func (server *FiberServer) Listen(_ context.Context) error

func (*FiberServer) Name

func (server *FiberServer) Name() string

func (*FiberServer) WithConfig

func (server *FiberServer) WithConfig(config ServerFiberConfig) *FiberServer

WithConfig initializes the ServerFiberConfig that will be used to start the fiber.App.

func (*FiberServer) WithFiberConfig

func (server *FiberServer) WithFiberConfig(config *fiber.Config) *FiberServer

func (*FiberServer) WithName

func (server *FiberServer) WithName(name string) *FiberServer

WithName will initialize the name of the service.

type Initializer

type Initializer func(app *fiber.App) error

Initializer is a function that will receive the fiber.App instance with the objetive of initialize its middlewares and routes.

type ServerFiberConfig

type ServerFiberConfig interface {
	GetBindAddress() string
}

ServerFiberConfig defines the configuration contract to be used on the FiberServer.

type ViperConfig

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

ViperConfig implements ServerFiberConfig using github.com/spf13/viper.

func (*ViperConfig) GetBindAddress

func (config *ViperConfig) GetBindAddress() string

func (ViperConfig) WithPrefix

func (config ViperConfig) WithPrefix(prefix string) ViperConfig

WithPrefix returns a copy of ViperConfig with the prefix set.

func (ViperConfig) WithViper

func (config ViperConfig) WithViper(v *viper.Viper) ViperConfig

WithViper returns a copy of ViperConfig with the base viper.Viper instance (used to read all configuration from) set.

Jump to

Keyboard shortcuts

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