http

package
v0.0.0-...-ffd3783 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ShutdownTimeout = 1 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootstrapper

type Bootstrapper interface {
	BootstrapControllers(db *dbCommon.DB) []Controller
}

type Controller

type Controller interface {
	RegisterRoutes(r *mux.Router)
}

type ErrorResponse

type ErrorResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

type Responder

type Responder struct{}

func NewResponder

func NewResponder() *Responder

func (*Responder) RespondError

func (r *Responder) RespondError(w http.ResponseWriter, message string, httpStatus int)

func (*Responder) RespondErrorNotFound

func (r *Responder) RespondErrorNotFound(w http.ResponseWriter)

func (*Responder) RespondSuccessNoContent

func (r *Responder) RespondSuccessNoContent(w http.ResponseWriter)

func (*Responder) RespondSuccessOk

func (r *Responder) RespondSuccessOk(w http.ResponseWriter, data any, n int)

type Server

type Server struct {
	Addr   string
	Domain string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(controllers []Controller) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) Open

func (s *Server) Open() (err error)

func (*Server) RegisterRoutes

func (s *Server) RegisterRoutes()

type SuccessResponse

type SuccessResponse struct {
	Status string `json:"status"`
	Data   any    `json:"data"`
	N      int    `json:"count"`
}

Jump to

Keyboard shortcuts

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