server

package
v0.0.0-...-645f013 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package server contains a HTTP server for serving the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server implements an HTTP server. It is set up as a http.Handler. Example:

srv := server.New(...)
httpSrv := &http.Server{
  Addr: ":8080",
  Handler: srv,
}
httpSrv.ListenAndServe()

func New

func New(options ...ServerOption) *Server

New creates and initializes a new server using the given options.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles a HTTP request.

type ServerOption

type ServerOption func(*Server)

ServerOption specifies a signature for configuring the server.

func WithLogger

func WithLogger(logger log.Logger) ServerOption

WithLogger allows to configure the logger being used. By default, the server will not log anything.

Jump to

Keyboard shortcuts

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