rest

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoggingMiddleware added in v0.4.0

func NewLoggingMiddleware(logger abstraction.Logger) func(http.Handler) http.Handler

NewLoggingMiddleware returns a middleware for logging requests

Types

type Handler

type Handler struct {
	*base.Component
}

Handler represents a basic REST handler

func NewHandler

func NewHandler(logger abstraction.Logger, handlerName string) *Handler

NewHandler returns a new basic REST handler instance

func (Handler) DecodeFromJSON added in v0.4.0

func (h Handler) DecodeFromJSON(r io.Reader, value interface{}) error

DecodeFromJSON obtains a value from the body of the request

func (Handler) RespondWithError

func (h Handler) RespondWithError(w http.ResponseWriter, code int, message string)

RespondWithError sends an error response in JSON Format

func (Handler) RespondWithJSON

func (h Handler) RespondWithJSON(w http.ResponseWriter, code int, payload interface{})

RespondWithJSON sends a response in RespondWithJSON Format

type Settings added in v0.4.0

type Settings struct {
	Address         string
	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	GracefulTimeout time.Duration
}

Settings contains the configuration values for the AppServer

func DefaultSettings added in v0.4.0

func DefaultSettings() *Settings

DefaultSettings provides the default settings for a server

Jump to

Keyboard shortcuts

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