http

package
v0.0.0-...-d384908 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ContentTypeJSON represents JSON content type
	ContentTypeJSON = "application/json; charset=UTF-8"
	//ContentTypeXML represents XML content type
	ContentTypeXML = "application/xml; charset=UTF-8"
	//ContentTypeYaml represents yaml
	ContentTypeYaml = "application/x-yaml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HealthReport

type HealthReport struct {
	Status string `json:"status" yaml:"status"`
}

HealthReport represents a health report

type Payload

type Payload interface {
	RequestReader
	ResponseReadWriter
}

Payload represents an generic interface to read and write data from HTTP Request or Response

func NewPayload

func NewPayload() Payload

NewPayload returns a new instance of Payload

type RequestReader

type RequestReader interface {
	ReadRequest(contentType string, data interface{}, r *http.Request) error
}

RequestReader represents a generic interface to read from HTTP Request

type ResponseReadWriter

type ResponseReadWriter interface {
	WriteResponse(contentType string, status int, data interface{}, w http.ResponseWriter)
	ReadResponse(contentType string, data interface{}, response *http.Response) error
}

ResponseReadWriter represents a generic interface to read from and write to HTTP Response

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

Route defines an http route

type Routes

type Routes []Route

Routes is a collection of http routes supported by this web application

type Server

type Server interface {
	Start()
}

Server base http server

func NewServer

func NewServer(addr string, tls bool, certFile, keyFile string, routes Routes) Server

NewServer creates a new instance of http server

Jump to

Keyboard shortcuts

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