server

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package server holds the structs and methods containing the logic to spin up the api server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LifeCycleHook

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

LifeCycleHook can be used to add custom functions in the server lifecycle

func NewLifeCycleHook

func NewLifeCycleHook(initFunc func(), deferFunc func()) *LifeCycleHook

NewLifeCycleHook takes an initFunc and a deferFunc as arguments and returns a new LifeCycleHook

type Options added in v0.2.0

type Options struct {
	Handler       http.Handler
	Port          int
	LifeCycleHook *LifeCycleHook
}

Options represents the Server options

type Server

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

Server struct wraps a http.Handler and the LifeCycleHook

func NewServer

func NewServer(options Options) *Server

NewServer returns a new Server configurable with Options

func (*Server) Start

func (s *Server) Start(stop <-chan struct{}) error

Start is used to start a http.Server and wait for a kill signal to gracefully shutdown the server

Jump to

Keyboard shortcuts

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