server

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 5 Imported by: 0

README

go-http-server

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Code string `json:"Code"`
	S    string `json:"Message"`
}

func NewError

func NewError(errorCode string, errorMessage string) ApiError

func NewErrorS

func NewErrorS(errorMessage string) ApiError

func (ApiError) Error

func (o ApiError) Error() string

type HttpHandler

type HttpHandler func(w http.ResponseWriter, r *http.Request) (interface{}, error)

type HttpHandlerWithoutReturn

type HttpHandlerWithoutReturn func(w http.ResponseWriter, r *http.Request)

func HandleRequest

func HandleRequest(route RouteDefinition) HttpHandlerWithoutReturn

type HttpServer

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

func New

func New() *HttpServer

func (*HttpServer) GetRoutes

func (s *HttpServer) GetRoutes() *RoutesMap

func (*HttpServer) RegisterRoutes

func (s *HttpServer) RegisterRoutes(routes map[string]RouteDefinition)

func (*HttpServer) Start

func (s *HttpServer) Start() error

type RouteDefinition

type RouteDefinition struct {
	Method   string
	Function HttpHandler
}

type RoutesMap

type RoutesMap map[string]RouteDefinition

Jump to

Keyboard shortcuts

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