http

package
v0.0.0-...-b650831 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Json

func Json(w http.ResponseWriter, statusCode int, payload interface{})

func JsonMiddleware

func JsonMiddleware(next http.Handler) http.Handler

Types

type Meta

type Meta struct {
	Size  int `json:"size"`
	Total int `json:"total"`
}

type Options

type Options func(opts *Server) error

type Server

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

Server represents an HTTP server. It is meant to wrap all HTTP functionality used by the application so that dependent packages (such as cmd/pxthc) do not need to reference the "net/http" package at all.

func NewServer

func NewServer(opts ...Options) *Server

func (*Server) Config

func (s *Server) Config() *config.Config

func (*Server) Init

func (s *Server) Init(version string)

func (*Server) InitRoutes

func (s *Server) InitRoutes()

func (*Server) PrintAllRegisteredRoutes

func (s *Server) PrintAllRegisteredRoutes(exceptions ...string)

PrintAllRegisteredRoutes prints all registered routes from Chi router. definitely can be an extension to the router instead.

func (*Server) RegisterScrapers

func (s *Server) RegisterScrapers()

func (*Server) Run

func (s *Server) Run()

func (*Server) RunScrapers

func (s *Server) RunScrapers()

type Standard

type Standard struct {
	Data interface{} `json:"data"`
	Meta Meta        `json:"meta,omitempty"`
}

Jump to

Keyboard shortcuts

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