server

package
v0.6.29-beta002 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxLimit      = 1000
	DefaultLimit  = 100
	DefaultOffset = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port int
}

func (Config) Addr

func (c Config) Addr() string

type HTTPServer

type HTTPServer struct {
	Mux    *fiber.App
	Log    *zap.SugaredLogger
	Routes fiber.Router
	Config Config
}

HTTPServer represents basic REST HTTP server abstarction

func NewServer

func NewServer(config Config) HTTPServer

NewServer returns new HTTP server instance, initializes logger and metrics

func (*HTTPServer) Error

func (s *HTTPServer) Error(c *fiber.Ctx, status int, err error, context ...interface{}) error

Error writes rfc-7807 json problem to response

func (HTTPServer) GetPager

func (s HTTPServer) GetPager(c *fiber.Ctx) Pager

func (HTTPServer) HealthEndpoint

func (s HTTPServer) HealthEndpoint() fiber.Handler

func (*HTTPServer) Init

func (s *HTTPServer) Init()

Init initializes router and setting up basic routes for health and metrics

func (HTTPServer) Run

func (s HTTPServer) Run() error

Run starts listening for incoming connetions

type Pager

type Pager struct {
	Limit  int
	Offset int
	NextID string
}

Jump to

Keyboard shortcuts

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