web

package
v0.0.0-...-65ffb28 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*http.Server
	Router *mux.Router
	// contains filtered or unexported fields
}

Server implements the web server for the Tonic service.

func New

func New(port uint16) *Server

New returns a web Server with an initialised mux.Router and http.Server.

func (*Server) ErrorResponse

func (ws *Server) ErrorResponse(w http.ResponseWriter, status int, message string)

ErrorResponse logs an error and renders an error page with the given message, returning the given status code to the user.

func (*Server) SetLogger

func (ws *Server) SetLogger(l *log.Logger)

SetLogger sets the logger instance for the web service. If unset the service defines its own logger with the same configuration as the standard Logger.

func (*Server) Start

func (ws *Server) Start()

Start starts the embedded web server's ListenAndServe method in a goroutine and returns. This method does not block. Use WaitForInterrupt() or implement your own blocking function to wait for any other stop condition.

func (*Server) Stop

func (ws *Server) Stop()

Stop gracefully stops the web service.

Jump to

Keyboard shortcuts

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