server

package
v0.0.0-...-057099a Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorCritical = fmt.Errorf("critical error")
)

Custom errors

Functions

This section is empty.

Types

type Config

type Config struct {
	Port        uint
	BackendURL  string
	FrontendURL string
	Console     bool
	Debug       bool
}

Config for the http server

type Server

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

Server is the main struct for the http server wrapped around Gin

func NewServer

func NewServer(cfg Config) *Server

NewServer creates a new server instance

func (*Server) ApplyMiddlewares

func (s *Server) ApplyMiddlewares(svc database.Service, secretKey string) error

Applies middlewares to the gin engine like recovery, custom logging, cors, rate limiting and sessions

func (*Server) SetupRoutes

func (s *Server) SetupRoutes(twitchRedirectURI string, svc database.Service) error

SetupRoutes sets up the routes for the gin engine

func (*Server) Start

func (s *Server) Start(ctx context.Context, errChan chan error, wg *sync.WaitGroup)

Start starts the server and listens for incoming requests

Blocks until the context is canceled or a critical error occurs

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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