server

package
v0.0.0-...-b3ee4c8 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2017 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr      string
	SecretKey string
	Database  *db.Connection
	Tweeter   *tweeter.Tweeter
}

Config provides parameters for hosting the website.

type Server

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

Server provides the web UI for interacting with the application. Users can login, post suggestions, and queue items if they have the appropriate permissions.

func New

func New(cfg *Config) (*Server, error)

New creates a new server with the specified configuration.

func (*Server) Close

func (s *Server) Close()

Close shuts down the server and waits for it to complete.

func (*Server) ServeHTTP

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

ServeHTTP does preparatory work for the handlers. It attempts to load the user from the database if authenticated and ensures that POST requests have their forms parsed.

Jump to

Keyboard shortcuts

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