webserver

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 7 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 *slog.Logger) Option

Logger overrides the default logger in the Server.

func Middlewares

func Middlewares(middlewares ...middleware.Middleware) Option

Middlewares allows to specify which middleware to use. This is also useful if you want to override the default Cors middleware to limit which domains CORS should be applicable to.

func ReadTimeout

func ReadTimeout(d time.Duration) Option

ReadTimeout overrides the default read timeout for the HTTP Server

func Services

func Services(services ...Service) Option

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

func TLSConfig

func TLSConfig(cfg *tls.Config) Option

TLSConfig allows to set the TLS configuration for the server.

func WriteTimeout

func WriteTimeout(d time.Duration) Option

WriteTimeout overrides the default write timeout for the HTTP Server

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.

Directories

Path Synopsis
Package certificate provides configuration loader.
Package certificate provides configuration loader.
temporary
Package temporary provides generated and temporary certificate.
Package temporary provides generated and temporary certificate.

Jump to

Keyboard shortcuts

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