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

api

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Token string
	// contains filtered or unexported fields
}

API is the http server responsible for serving the HTTP API endpoints

func New

func New(token string) *API

New is a factory function creating a new API instance

func (*API) RegisterFunc

func (api *API) RegisterFunc(path string, fn http.HandlerFunc)

RegisterFunc is a wrapper around http.HandleFunc that also sets the flag used to determine whether to launch the API

func (*API) RegisterHandler

func (api *API) RegisterHandler(path string, handler http.Handler)

RegisterHandler is a wrapper around http.Handler that also sets the flag used to determine whether to launch the API

func (*API) RequireToken

func (api *API) RequireToken(fn http.HandlerFunc) http.HandlerFunc

RequireToken is wrapper around http.HandleFunc that checks token validity

func (*API) Start

func (api *API) Start(block bool) error

Start the API and serve over HTTP. Requires an API Token to be set.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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