handlers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func API

func API(build string, shutdown chan os.Signal, log *log.Logger, db *sqlx.DB, authenticator *auth.Authenticator) http.Handler

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

Types

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, params map[string]string) error

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

type Product

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

Product represents the Product API method handler set.

func (*Product) Create

func (p *Product) Create(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error

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

func (*Product) Delete

func (p *Product) Delete(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error

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

func (*Product) List

func (p *Product) List(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error

List gets all existing products in the system.

func (*Product) Retrieve

func (p *Product) Retrieve(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error

Retrieve returns the specified product from the system.

func (*Product) Update

func (p *Product) Update(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error

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

type User

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

User represents the User API method handler set.

func (*User) Create

func (u *User) Create(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error

Create inserts a new user into the system.

func (*User) Delete

func (u *User) Delete(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error

Delete removes the specified user from the system.

func (*User) List

func (u *User) List(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error

List returns all the existing users in the system.

func (*User) Retrieve

func (u *User) Retrieve(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error

Retrieve returns the specified user from the system.

func (*User) Token

func (u *User) Token(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error

Token handles a request to authenticate a user. It expects a request using Basic Auth with a user's email and password. It responds with a JWT.

func (*User) Update

func (u *User) Update(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error

Update updates the specified user in the system.

Jump to

Keyboard shortcuts

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