Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(settings func() *types.BasicAuth) func(http.Handler) http.Handler

func CORS

func CORS(next http.Handler) http.Handler

func Info

func Info(app, version string) func(http.Handler) http.Handler

func Ping

func Ping(path ...string) func(http.Handler) http.Handler

func Recoverer

func Recoverer(next http.Handler) http.Handler

Types

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware type for middleware functions

type Rest

type Rest struct {
	Monitor   *monitor.Monitor
	Templates *html.Templates
	Config    *types.Cfg

	Version string
	// contains filtered or unexported fields
}

func (*Rest) Router

func (s *Rest) Router() *http.ServeMux

type Router

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

Router struct to hold our routes and middleware

func NewRouter

func NewRouter(middlewares ...Middleware) *Router

NewRouter creates and returns a new App with an initialized ServeMux and middleware slice

func (*Router) Handle

func (r *Router) Handle(pattern string, handler http.Handler)

Handle registers a handler for a specific route, applying all middleware.

func (*Router) HandleFunc

func (r *Router) HandleFunc(pattern string, handler http.HandlerFunc)

HandleFunc registers a handler function for a specific route, applying all middleware.

func (*Router) Use

func (r *Router) Use(middlewares ...Middleware)

Use adds middlewares to the chain

type Server

type Server struct {
	Address string
	Port    int

	ReadHeaderTimeout time.Duration
	WriteTimeout      time.Duration
	IdleTimeout       time.Duration
	// contains filtered or unexported fields
}

Server - rest server struct

func (*Server) Run

func (s *Server) Run(router http.Handler) error

Run - will initialize server and run it on provided port

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown - shutdown rest server

Jump to

Keyboard shortcuts

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