http

package
v0.0.0-...-6b2a69b Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountsStore

type AccountsStore = accounts.Store

type ArgumentsStore

type ArgumentsStore = arguments.Store

type Dependencies

type Dependencies interface {
	email.Emailer
	accounts.Store
	arguments.Store
}

Dependencies for all the server's endpoints

type Server

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

Server runs the service. Use NewServer() to construct one from an app config, and Start() to make it start listening and serving requests.

func NewServer

func NewServer(key *ecdsa.PrivateKey, store Dependencies) *Server

NewServer makes a server which defines REST endpoints for the service.

func (*Server) Handle

func (s *Server) Handle(w http.ResponseWriter, req *http.Request)

Handle exists to make testing easier. It lets the Server act without having to bind to a port.

func (*Server) Start

func (s *Server) Start(cfg config.Server, done chan<- struct{}) error

Start connects the API server to its port and blocks until it hears a shutdown signal. Once the server has shut down completely, it adds an element to the done channel.

type ServerDependencies

type ServerDependencies struct {
	email.Emailer
	AccountsStore
	ArgumentsStore
}

Jump to

Keyboard shortcuts

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