example
import "github.com/unprofession-al/httpthings/example"
Index
func BasicAuth
func BasicAuth(handler http.HandlerFunc) http.HandlerFunc
func WrapBasicAuth
func WrapBasicAuth(e endpoint.Endpoint, hf http.HandlerFunc) http.HandlerFunc
type App
type App struct {
// contains filtered or unexported fields
}
type HTTPError
type HTTPError struct {
Code int `json:"code" yaml:"code"`
Message string `json:"message" yaml:"message"`
}
func (HTTPError) Respond
func (e HTTPError) Respond(status int, details string, w http.ResponseWriter, r *http.Request)
type Note
type Note struct {
Note string
Important bool
}
type Server
type Server struct {
// contains filtered or unexported fields
}
func NewServer
func NewServer(listener, static string) (Server, error)
func (Server) AddTodoEndpoint
func (s Server) AddTodoEndpoint() *endpoint.Endpoint
func (Server) FinishTodoEndpoint
func (s Server) FinishTodoEndpoint() *endpoint.Endpoint
func (Server) ListTodoEndpoint
func (s Server) ListTodoEndpoint() *endpoint.Endpoint
func (Server) ShowTodoEndpoint
func (s Server) ShowTodoEndpoint() *endpoint.Endpoint
type Todo
type Todo struct {
Name string `json:"name" yaml:"name" jsonschema:"minLength=3"`
Description string `json:"description" yaml:"description"`
Done bool `json:"done" yaml:"done"`
Notes []Note `json:"notes" yaml:"notes"`
}
func (*Todo) Finish
func (t *Todo) Finish()
type TodoRequest
type TodoRequest struct {
Name string `json:"name" yaml:"name" jsonschema:"minLength=3"`
Description string `json:"description" yaml:"description"`
}
func (*TodoRequest) AsTodo
func (tr *TodoRequest) AsTodo() *Todo
type TodoSet
type TodoSet map[string]*Todo
func NewTodoSet
func NewTodoSet() *TodoSet
func (TodoSet) Add
func (ts TodoSet) Add(in *Todo) bool
func (TodoSet) AsSlice
func (ts TodoSet) AsSlice() []*Todo
func (*TodoSet) Prepopulate
func (ts *TodoSet) Prepopulate() *TodoSet
Generated by gomarkdoc