http

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InternalServerError = 500
	PathError           = 402
	FileError           = 336
	NotFoundError       = 404
)

Variables

This section is empty.

Functions

func GetString

func GetString(code int) string

func HandleCustom

func HandleCustom(url string, cb func(w ResponseWriter, r *Request))

func HandleStaticFile

func HandleStaticFile(url string, filename string, contentType string)

func HandleTemplate

func HandleTemplate(url string, tmpl *Template)

func Init

func Init(portint int) error

func RenderTemplate

func RenderTemplate(w ResponseWriter, tmpl *Template) error

func Serve

func Serve()

Types

type Request

type Request = http.Request

type ResponseWriter

type ResponseWriter = http.ResponseWriter

type ServerError

type ServerError struct {
	Code int
	Msg  string
}

func Error

func Error(errNum int, msg string, w ResponseWriter) *ServerError

func (*ServerError) ToErr

func (s *ServerError) ToErr() (err error)

type Template

type Template struct {
	Filename string
	Value    interface{}
}

func NewTemplate

func NewTemplate(filename string, val interface{}) *Template

Jump to

Keyboard shortcuts

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