webserver

package
v0.15.11 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 14 Imported by: 5

Documentation

Index

Constants

View Source
const (
	CONTENT_TYPE      = "Content-Type"
	CONTENT_TYPE_JSON = "application/json"
	AUTHORIZATION     = "Authorization"
)

Variables

View Source
var ErrIncorrectContentType = fmt.Errorf("http header did not contain key %s with value %s", CONTENT_TYPE, CONTENT_TYPE_JSON)

Functions

func ErrorResponse added in v0.4.2

func ErrorResponse(c *gin.Context, message string, httpStatusCode int)

func GetAuthHeader added in v0.4.2

func GetAuthHeader(c *gin.Context) (header string)

func UnmarshalBody added in v0.4.2

func UnmarshalBody[bodyT any](c *gin.Context) (v bodyT, err error)

Types

type Server

type Server struct {
	Base *gin.RouterGroup
	API  *gin.RouterGroup
	// contains filtered or unexported fields
}

func Init

func Init(port uint16, from_base bool) (*Server, error)

func (Server) Port added in v0.8.0

func (s Server) Port() uint16

func (Server) Run

func (s Server) Run()

func (Server) Url added in v0.8.0

func (s Server) Url() (u *url.URL)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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