server

package
v0.0.0-...-932f842 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package server starts a web server with some preset routes and configuration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Admin

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

Admin struct stores resources needed by the API

func (*Admin) GetCache

func (a *Admin) GetCache(_ context.Context) ([]byte, error)

GetCache retrieves stats from the cache

func (*Admin) SetResources

func (a *Admin) SetResources(db *pgxpool.Pool, cache *webcache.WebCache)

SetResources sets the DB to be used by the Github API

type Server

type Server struct {
	Config     *config.Config
	Router     *httprouter.Router
	DB         *pgxpool.Pool
	Log        *logging.Logger
	Cache      *webcache.WebCache
	GzipPool   *compress.GzipPool
	BrotliPool *compress.BrotliPool
	Limiter    *limiter.Limiter
	// contains filtered or unexported fields
}

Server stores configuration for currently running server instance

func (*Server) Cacher

func (s *Server) Cacher(w http.ResponseWriter, r *http.Request, group, key string)

Cacher stores and retrieves assets from the cache.

func (*Server) HandlePanic

func (s *Server) HandlePanic(f http.HandlerFunc) http.HandlerFunc

HandlePanic will recover and log a panic.

func (*Server) Init

func (s *Server) Init()

Init loads the config and sets the server up to be started

func (*Server) Logger

func (s *Server) Logger(f http.HandlerFunc) http.HandlerFunc

Logger writes request info to the configured log file.

type StaticData

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

StaticData stores the root path for static and root handlers

func (*StaticData) Get

func (s *StaticData) Get(_ context.Context, key string) ([]byte, error)

Get loads static data when not found in the cache

Jump to

Keyboard shortcuts

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