server

package
v0.0.0-...-c5adbc6 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 50 Imported by: 0

Documentation

Overview

Package server implements the web server, routes and middleware for the code-and-chill application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Err string `json:"error"`
}

func (*APIError) Error

func (e *APIError) Error() string

type APIGetUserResponse

type APIGetUserResponse struct {
	User *auth.User `json:"user"`
}

type APIListUsersResponse

type APIListUsersResponse struct {
	Users map[string]*auth.User `json:"users"`
}

type APIResetUserProgressResponse

type APIResetUserProgressResponse struct {
	OK bool `json:"ok"`
}

type APIUpdateUserRequest

type APIUpdateUserRequest struct {
	Name         *string `json:"name"`
	AvatarURL    *string `json:"avatar_url"`
	RandomAvatar *bool   `json:"random_avatar"`
	Token        *string `json:"token"`
	Admin        *bool   `json:"admin"`
	Hidden       *bool   `json:"hidden"`
	Tester       *bool   `json:"tester"`
}

type APIUpdateUserResponse

type APIUpdateUserResponse struct {
	User *auth.User `json:"user"`
}

type Config

type Config struct {
	Host              string        `yaml:"host"`
	Port              int           `yaml:"port"`
	TLSCertFile       string        `yaml:"tlsCertFile"`
	TLSKeyFile        string        `yaml:"tlsKeyFile"`
	TLSReloadSchedule string        `yaml:"tlsReloadSchedule"`
	HTTPSRedirect     bool          `yaml:"httpsRedirect"`
	DataDir           string        `yaml:"dataDir"`
	ShutdownTimeout   time.Duration `yaml:"shutdownTimeout"`
	APIPort           int           `yaml:"apiPort"`
}

type Server

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

func New

func New(config Config, db *db.DB, session *session.Store, auth *auth.Auth, puzzles *puzzles.Puzzles, notif *notifier.Notifier) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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