web

package module
v0.0.0-...-70f7341 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: MIT Imports: 10 Imported by: 0

README

web

pkg.go.dev GoDoc Build Status GolangCI GitHub

Package web provides essential components to creating JSON web applications

License

MIT licensed, see here

Documentation

Overview

Package web provides essential components to creating JSON web applications

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(routes []Route) http.Handler

func RecovererMiddleware

func RecovererMiddleware(next http.Handler) http.Handler

Types

type RequestLogEntry

type RequestLogEntry struct {
	Request *http.Request
}

func (RequestLogEntry) Panic

func (rle RequestLogEntry) Panic(val interface{}, stack []byte)

func (RequestLogEntry) Write

func (rle RequestLogEntry) Write(status, bytes int, elapsed time.Duration)

type RequestLogger

type RequestLogger struct{}

func (RequestLogger) NewLogEntry

func (rl RequestLogger) NewLogEntry(req *http.Request) middleware.LogEntry

type Route

type Route struct {
	Method      string
	Path        string
	Middlewares []func(http.Handler) http.Handler
	Handler     http.HandlerFunc
}

type Server

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

func NewServer

func NewServer(handler http.Handler, config ServerConfig) *Server

func (*Server) Serve

func (s *Server) Serve() error

type ServerConfig

type ServerConfig struct {
	Addr string
}

Jump to

Keyboard shortcuts

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