rest

package
v0.0.0-...-67397eb Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	HTTPAddress                   string        `yaml:"address"`
	HTTPPort                      int           `yaml:"port"`
	HTTPServerReadTimeout         time.Duration `yaml:"readTimeout"`
	HTTPServerWriteTimeout        time.Duration `yaml:"writeTimeout"`
	HTTPServerIdleTimeout         time.Duration `yaml:"idleTimeout"`
	ServerGracefulShutdownTimeout time.Duration `yaml:"gracefulShutdownTimeout"`
}

Config for a HTTP server

func (*Config) SetDefaults

func (c *Config) SetDefaults()

type Server

type Server struct {
	Router *chi.Mux
	Server *http.Server
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cfg *Config, logger *slog.Logger, router *chi.Mux) (*Server, error)

func (*Server) Start

func (s *Server) Start() error

Start the HTTP server and blocks until we either receive a signal or the HTTP server returns an error.

Jump to

Keyboard shortcuts

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