controller

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package controller provides application controllers that convert incoming requests to domain models, run business logic on them and return the results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RESTController

type RESTController struct {
	// contains filtered or unexported fields
}

RESTController represents a controller capable of handling HTTP requests and yielding a corresponding JSON result.

func NewRESTController

func NewRESTController(app *core.App) *RESTController

NewRESTController returns a new REST controller instance that will use the provided app instance for running business logic.

func (*RESTController) CreateToDo

func (r *RESTController) CreateToDo() http.HandlerFunc

CreateToDo processes a POST request for creating a ToDo item. It expects a ToDo item without ID and returns an item containing the ID.

func (*RESTController) DeleteToDo

func (r *RESTController) DeleteToDo() http.HandlerFunc

DeleteToDo processes a DELETE request for deleting a single ToDo item. This will also delete all of the item's sub-tasks.

Expects the `id` URL parameter.

func (*RESTController) GetToDo

func (r *RESTController) GetToDo() http.HandlerFunc

GetToDo processes a GET request for retrieving a single ToDo item by ID.

Expects the `id` URL parameter.

func (*RESTController) GetToDos

func (r *RESTController) GetToDos() http.HandlerFunc

GetToDos processes a GET request for listing all ToDo items.

func (*RESTController) UpdateToDo

func (r *RESTController) UpdateToDo() http.HandlerFunc

UpdateToDo processes a PUT request for updating a ToDo item. The item with the given ID will be overridden by the item in the request body.

Expects the `id` URL parameter.

Jump to

Keyboard shortcuts

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