server

package
v0.0.0-...-1876e9c Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const CHORDS_TEMPLATE = `` /* 1953-byte string literal not displayed */

TODO: the JavaScript code should go in a separate .js file Arguably, so should the HTML.

View Source
const FOOTER = `` /* 315-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type ChordsAPI

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

type Frontend

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

func NewFrontend

func NewFrontend(apiURL string) (*Frontend, error)

type ResponseWriterWrapper

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

ResponseWriterWrapper struct is used to log the response

func NewResponseWriterWrapper

func NewResponseWriterWrapper(w http.ResponseWriter) ResponseWriterWrapper

NewResponseWriterWrapper static function creates a wrapper for the http.ResponseWriter

func (ResponseWriterWrapper) Header

func (rww ResponseWriterWrapper) Header() http.Header

Header function overwrites the http.ResponseWriter Header() function

func (ResponseWriterWrapper) String

func (rww ResponseWriterWrapper) String() string

func (ResponseWriterWrapper) Write

func (rww ResponseWriterWrapper) Write(buf []byte) (int, error)

func (ResponseWriterWrapper) WriteHeader

func (rww ResponseWriterWrapper) WriteHeader(statusCode int)

WriteHeader function overwrites the http.ResponseWriter WriteHeader() function

type Server

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

func New

func New(db dblayer.ChordsDB, addr string, logger *log.Logger, authKey string) (*Server, error)

New returns a new Server with the specified DB and address. `logFlags` is as provided to log.New - see https://pkg.go.dev/log#pkg-constants

func (*Server) Kill

func (s *Server) Kill() error

Shuts down the HTTP server - necessary for running tests back-to-back.

func (*Server) Listen

func (s *Server) Listen() (net.Addr, error)

Listen opens a network connection (non-blocking) and returns the address that it's listening on.

func (*Server) Run

func (s *Server) Run() error

func (*Server) Serve

func (s *Server) Serve() error

Serve serves the HTTP server (blocking)

Jump to

Keyboard shortcuts

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