Documentation ¶
Index ¶
- Constants
- func DecodeJSON(r io.Reader, v interface{}) error
- func New(config *koanf.Koanf) (core.Server, error)
- func RenderErrInternal(w http.ResponseWriter, err error)
- func RenderErrInternalWithID(w http.ResponseWriter, err error) string
- func RenderErrInvalidRequest(w http.ResponseWriter, err error)
- func RenderErrNotFound(w http.ResponseWriter)
- func RenderErrResourceNotFound(w http.ResponseWriter, resource string)
- func RenderErrUnauthorized(w http.ResponseWriter)
- func RenderJSON(w http.ResponseWriter, code int, v interface{})
- func RenderNoContent(w http.ResponseWriter)
- type ErrResponse
- type RestServer
- func (s *RestServer) PomodoroDeleteByID() http.HandlerFunc
- func (s *RestServer) PomodoroGetByID() http.HandlerFunc
- func (s *RestServer) PomodoroSave() http.HandlerFunc
- func (s *RestServer) Router() chi.Router
- func (s *RestServer) Setup() error
- func (s *RestServer) Start()
- func (s *RestServer) StatusGet() http.HandlerFunc
- func (s *RestServer) StatusSave() http.HandlerFunc
- func (s *RestServer) Stop()
- func (s *RestServer) TaskDeleteByID() http.HandlerFunc
- func (s *RestServer) TaskGetByID() http.HandlerFunc
- func (s *RestServer) TaskSave() http.HandlerFunc
- func (s *RestServer) TasksFind() http.HandlerFunc
Constants ¶
View Source
const ( TASK_PATH = "/tasks" TASK_ID_PATH = TASK_PATH + "/{id}" POMODORO_PATH = "/pomodoros" POMODORO_ID_PATH = POMODORO_PATH + "/{id}" STATUS_PATH = "/status" )
Variables ¶
This section is empty.
Functions ¶
func DecodeJSON ¶
func RenderErrInternal ¶
func RenderErrInternal(w http.ResponseWriter, err error)
func RenderErrInternalWithID ¶
func RenderErrInternalWithID(w http.ResponseWriter, err error) string
func RenderErrInvalidRequest ¶
func RenderErrInvalidRequest(w http.ResponseWriter, err error)
func RenderErrNotFound ¶
func RenderErrNotFound(w http.ResponseWriter)
func RenderErrResourceNotFound ¶
func RenderErrResourceNotFound(w http.ResponseWriter, resource string)
func RenderErrUnauthorized ¶
func RenderErrUnauthorized(w http.ResponseWriter)
func RenderJSON ¶
func RenderJSON(w http.ResponseWriter, code int, v interface{})
RenderJSON writes an http response using the value passed in v as JSON. If it cannot convert the value to JSON, it returns an error
func RenderNoContent ¶
func RenderNoContent(w http.ResponseWriter)
Types ¶
type ErrResponse ¶
type RestServer ¶
type RestServer struct {
// contains filtered or unexported fields
}
RestServer is the Rest web server
func (*RestServer) PomodoroDeleteByID ¶
func (s *RestServer) PomodoroDeleteByID() http.HandlerFunc
PomodoroDeleteByID deletes a pomodoro
func (*RestServer) PomodoroGetByID ¶
func (s *RestServer) PomodoroGetByID() http.HandlerFunc
PomodoroGetByID returns the pomodoro
func (*RestServer) PomodoroSave ¶
func (s *RestServer) PomodoroSave() http.HandlerFunc
PomodoroSave saves a pomodoro
func (*RestServer) StatusGet ¶
func (s *RestServer) StatusGet() http.HandlerFunc
GetStatus returns the server status
func (*RestServer) StatusSave ¶
func (s *RestServer) StatusSave() http.HandlerFunc
StatusSave saves the server status
func (*RestServer) Stop ¶
func (s *RestServer) Stop()
func (*RestServer) TaskDeleteByID ¶
func (s *RestServer) TaskDeleteByID() http.HandlerFunc
TaskDeleteByID deletes a task
func (*RestServer) TaskGetByID ¶
func (s *RestServer) TaskGetByID() http.HandlerFunc
TaskGetByID returns the task
func (*RestServer) TaskSave ¶
func (s *RestServer) TaskSave() http.HandlerFunc
TaskSave saves a task
func (*RestServer) TasksFind ¶
func (s *RestServer) TasksFind() http.HandlerFunc
TasksFind finds tasks
Click to show internal directories.
Click to hide internal directories.