handlers

package
v0.0.0-...-fdd12d1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package handlers provides the translation between the HTTP layer and application business logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func API

func API(db *sqlx.DB, log *log.Logger, authenticator *auth.Authenticator) http.Handler

API constructs an http.Handler with all application routes defined.

Types

type Cards

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

Cards defines all of the handlers related to Cards. It holds the application state needed by the handler methods.

func (*Cards) Create

func (c *Cards) Create(ctx context.Context, w http.ResponseWriter, r *http.Request) error

Create decodes the body of a request to create a new card. The full card with generated fields is sent back in the response.

func (*Cards) Delete

func (c *Cards) Delete(ctx context.Context, w http.ResponseWriter, r *http.Request) error

Delete removes a single card identified by an ID in the request URL.

func (*Cards) List

func (c *Cards) List(ctx context.Context, w http.ResponseWriter, r *http.Request) error

List gets all Cards from the service layer.

func (*Cards) Retrieve

func (c *Cards) Retrieve(ctx context.Context, w http.ResponseWriter, r *http.Request) error

Retrieve finds a single card identified by an ID in the request URL.

func (*Cards) Update

func (c *Cards) Update(ctx context.Context, w http.ResponseWriter, r *http.Request) error

Update decodes the body of a request to update an existing card. The ID of the card is part of the request URL.

type Check

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

Check provides support for orchestration health checks.

func (*Check) Health

func (c *Check) Health(ctx context.Context, w http.ResponseWriter, r *http.Request) error

Health validates the service is healthy and ready to accept requests.

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

Menus defines all of the handlers related to Menus. It holds the application state needed by the handler methods.

func (m *Menus) Create(ctx context.Context, w http.ResponseWriter, r *http.Request) error

Create decodes the body of a request to create a new menu. The full menu with generated fields is sent back in the response.

func (m *Menus) Delete(ctx context.Context, w http.ResponseWriter, r *http.Request) error

Delete removes a single menu identified by an ID in the request URL.

func (m *Menus) List(ctx context.Context, w http.ResponseWriter, r *http.Request) error

List gets all Menus from the service layer.

func (m *Menus) Retrieve(ctx context.Context, w http.ResponseWriter, r *http.Request) error

Retrieve finds a single menu identified by an ID in the request URL.

func (m *Menus) Update(ctx context.Context, w http.ResponseWriter, r *http.Request) error

Update decodes the body of a request to update an existing menu. The ID of the menu is part of the request URL.

type Users

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

Users holds handlers for dealing with user.

func (*Users) Token

func (u *Users) Token(ctx context.Context, w http.ResponseWriter, r *http.Request) error

Token generates an authentication token for a user. The client must include an email and password for the request using HTTP Basic Auth. The user will be identified by email and authenticated by their password.

Jump to

Keyboard shortcuts

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