httpserver

package
v0.0.0-...-285c02a Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func File

func File(w http.ResponseWriter, resp []byte, code int, headers http.Header)

func JSON

func JSON(w http.ResponseWriter, resp any, code int)

JSON responds with an error and status code from the error.

Types

type Attachment

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

func NewAttachmentHandler

func NewAttachmentHandler(cfg *config.Config, log *wlog.Logger, dbpool *db.Connection) *Attachment

func (*Attachment) Attachment

func (a *Attachment) Attachment(w http.ResponseWriter, req *http.Request)

type Error

type Error struct {
	Msg string `json:"message,omitempty"`
}

Error represents an error for an end user.

type Response

type Response struct {
	Msg string `json:"message,omitempty"`
}

type Server

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

func New

func New(cfg *config.Config, log *wlog.Logger) *Server

func (*Server) RegisterHandlers

func (s *Server) RegisterHandlers(dbpool *db.Connection)

func (*Server) Serve

func (s *Server) Serve() error

func (*Server) Stop

func (s *Server) Stop() error

Jump to

Keyboard shortcuts

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