server

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

Package server provides the back-end implementation of the kjudge app.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotFoundHandler

func NotFoundHandler(c echo.Context) error

NotFoundHandler handles the "not found" situation. It should be a catch-all for all urls.

func StaticFiles

func StaticFiles(c echo.Context) error

StaticFiles serves files from the source fileb0x. It filters away files that don't end with ".css", ".js" or ".map"

Types

type Server

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

Server this the root entry of the server.

func New

func New(db *db.DB) (*Server, error)

New creates a new server.

func (*Server) HandleError

func (s *Server) HandleError(err error, c echo.Context)

HandleError defines an error handler that complies with echo's standards.

func (*Server) ServeHTTP added in v0.7.5

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves a single HTTP request. Useful for testing.

func (*Server) ServeHTTPRootCA added in v0.7.0

func (s *Server) ServeHTTPRootCA(address, rootCA string) error

ServeHTTPRootCA starts a HTTP server running on `address` serving the root CA from "/ca". It rejects all other requests.

func (*Server) SetupProfiling

func (s *Server) SetupProfiling()

SetupProfiling sets up profiling for the server in development mode.

func (*Server) Start

func (s *Server) Start(port int) error

Start starts the server, listening for requests.

func (*Server) StartWithSSL added in v0.7.0

func (s *Server) StartWithSSL(port int, privateKey, cert string) error

StartWithSSL starts the server with a given private key and certificate file paths.

func (*Server) StartWithTLS

func (s *Server) StartWithTLS(address string) error

StartWithTLS starts the server, also tries to get a cert from LetsEncrypt.

Directories

Path Synopsis
Package admin defines admin routes.
Package admin defines admin routes.
Package auth implements the authentication functions for the server.
Package auth implements the authentication functions for the server.
Package httperr provides some convenience functions to create echo HTTP errors.
Package httperr provides some convenience functions to create echo HTTP errors.
User implements a group that handle /user requests.
User implements a group that handle /user requests.

Jump to

Keyboard shortcuts

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