http

package
v0.0.0-...-39e06ca Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextIn

type ContextIn struct {
	Port                  int
	RoutesToRegister      []Routes
	MiddlewaresToRegister Middlewares
	TLSConfiguration      *TLSConfiguration
}

ContextIn describes dependecies needed by this package

type ContextOut

type ContextOut struct {
	Server Server
}

ContextOut describes dependencies exported by this package

func Bootstrap

func Bootstrap(in *ContextIn) *ContextOut

Bootstrap initializes this module with ContextIn and exports resulting ContextOut

type Middlewares

type Middlewares []func(http.Handler) http.Handler

Middlewares runs before every route

type Routes

type Routes interface {
	Register(agent RoutesAgent)
}

Routes is base type for types that implement routes

type RoutesAgent

type RoutesAgent interface {
	RegisterGet(path string, f func(w http.ResponseWriter, r *http.Request))
	RegisterPost(path string, f func(w http.ResponseWriter, r *http.Request))
	RegisterPut(path string, f func(w http.ResponseWriter, r *http.Request))
	RegisterDelete(path string, f func(w http.ResponseWriter, r *http.Request))
}

RoutesAgent is used to expose HTTP endpoints

type Server

type Server interface {
	Run()
	IsReady() bool
	Port() (int, error)
	Shutdown() error
}

Server encapsulates all HTTP exposed functionality of app

type TLSConfiguration

type TLSConfiguration struct {
	// CertFile to use for serving TLS traffic
	CertFile string
	// KeyFile to use for serving TLS traffic
	KeyFile string
}

TLSConfiguration for server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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