package
0.0.0-20210718062109-496be73d0ac7
Repository: https://github.com/piyuo/libsrv.git
Documentation: pkg.go.dev
# Functions
CommandEntry create command handler function
.
HTTPEntry create http handler function
.
Query return value from query string
value, ok := Query(r, "type") assert.True(ok) assert.Equal("maintenance", value)
.
TaskEntry create task entry function
.
No description provided by the author
WriteBinary to response
WriteBinary(w, bytes)
.
WriteError to response
WriteError(w, 500, errors.New("error"))
.
WriteStatus write status code and text response
WriteStatus(w, 500, "error")
.
WriteText to response
WriteText(w, "code")
.
# Structs
Server handle http request and call dispatch
server := &Server{ CommandHandlers: map[string]command.IMap{"/": &mock.MapXXX{}}, HTTPHandlers: map[string]HTTPHandler{"/api": httpHandler}, }
.
# Type aliases
HTTPHandler let you handle http request, return error will result InternalServerError
.
TaskHandler let you handle task request
.