apikit

package module
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 17 Imported by: 0

README

api-kit

A standard library for API services and CLIs

Documentation

Index

Constants

View Source
const (
	// default ports to listen on
	PORT_DEFAULT     = "8080"
	PORT_DEFAULT_TLS = "433"

	// ShutdownDelay is the time to wait for all request, go-routines etc complete
	ShutdownDelay = 30 // seconds
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

app holds all configs for the listener

func New

func New(setupFunc SetupFunc, shutdownFunc ShutdownFunc) (*App, error)

New creates a new service listener instance and configures it with sensible defaults.

func (*App) Listen

func (a *App) Listen(addr string)

func (*App) ListenAutoTLS

func (a *App) ListenAutoTLS(addr string)

func (*App) ListenTLS

func (a *App) ListenTLS(addr, certFile, keyFile string)

func (*App) Stop

func (a *App) Stop()

type SetupFunc

type SetupFunc func() *echo.Echo

SetupFunc creates a new, fully configured router

type ShutdownFunc

type ShutdownFunc func(context.Context, *App) error

ShutdownFunc is called before the app stops

Directories

Path Synopsis
cmd
examples
cli

Jump to

Keyboard shortcuts

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