server

package
v0.0.0-...-7a56003 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package server responds to incoming HTTP requests and renders the site.

There are a number of smaller servers in this package, each of which takes only the configuration necessary to serve it.

Example
settings := &config.Settings{
	PublicHost: "myapp.com",
	SecretKey:  nacl.NewKey(),
}
s, _ := NewServer(settings)
http.Handle("/", s)
http.ListenAndServe(":4114", nil)
Output:

Index

Examples

Constants

View Source
const HTML5DatetimeLocalFormat = "2006-01-02T15:04"
View Source
const Version = "1.6"

Server version, run "make release" to increase this value

Variables

This section is empty.

Functions

func AddAuthenticator

func AddAuthenticator(h http.Handler, ls *loginServer, a config.Authenticator) http.Handler

AddAuthenticator adds the Authenticator as a HTTP middleware. If authentication is successful, we set the User in the request context and continue.

func UpgradeInsecureHandler

func UpgradeInsecureHandler(h http.Handler, allowUnencryptedTraffic bool) http.Handler

Types

type Server

type Server struct {
	http.Handler

	DoneChan chan bool
	PageSize uint
	// contains filtered or unexported fields
}

func NewServer

func NewServer(settings *config.Settings) (*Server, error)

NewServer returns a new Handler that can serve the website.

func (*Server) CacheCommonQueries

func (s *Server) CacheCommonQueries()

func (*Server) Close

func (s *Server) Close() error

Jump to

Keyboard shortcuts

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