webserver

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 6 Imported by: 0

README

Safer Place Go Webserver

A semi-structured Safer Place webserver

Why

This is just an opinionated webserver implementation, standardized between all Go services

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Server) error

Option allows to override the default behaviour of the Server.

func Logger

func Logger(logger *zap.Logger) Option

Logger overrides the default logger in the Server.

func Services

func Services(services ...Service) Option

Services provides the server with the list of services which should be served.

type Server

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

Server hosts the connect service.

func New

func New(opts ...Option) (*Server, error)

New creates a new connect server.

func (*Server) Run

func (s *Server) Run(port int) error

Run the server. If the TLSConfiguration is provided, the server will run securely, otherwise it will run insecurely.

type Service

type Service func() (string, http.Handler)

Service registers the service with the server, it returns the path on which the server needs to be registered and the handler for that path.

Jump to

Keyboard shortcuts

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