httpserver

package
v0.0.0-...-e38db06 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseRouter

func BaseRouter(r *chi.Mux, ns string)

BaseRouter only exists to easily verify a working app and should normally be removed

Types

type ControllerRegistry

type ControllerRegistry struct {
	ExampleController example.ExampleController
}

type RouterConfig

type RouterConfig struct {
	Namespace string `validate:"required"`
}

type Server

type Server struct {
	Logger *logger.CustomLogger
	Port   uint
	Server *http.Server
}

Server defines a server for handling HTTP API requests

func NewServer

func NewServer(c *ServerConfig) (*Server, error)

NewServer returns a new Server instance

func (*Server) Serve

func (s *Server) Serve() error

Serve starts the HTTP server on the configured address

type ServerConfig

type ServerConfig struct {
	Controllers  *ControllerRegistry  `validate:"required"`
	Host         string               `validate:"required"`
	Logger       *logger.CustomLogger `validate:"required"`
	Port         uint                 `validate:"required"`
	RouterConfig *RouterConfig        `validate:"required"`
}

ServerConfig defines the input to NewServer

Jump to

Keyboard shortcuts

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