controllers

package
v0.0.0-...-8c0880b Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MovieController

func MovieController(h handlers.MovieHandler, r *mux.Router)

MovieController instantiates a movie controller.

func ServerResponse

func ServerResponse(w http.ResponseWriter, r *http.Request, hr handlers.HandlerResponse)

ServerResponse builds a HTTP response based on a handler response.

Types

type BaseErrorResponse

type BaseErrorResponse struct {
	Error     string    `json:"error"`
	Message   string    `json:"message"`
	Path      string    `json:"path"`
	Timestamp time.Time `json:"timestamp"`
}

BaseErrorResponse structure.

func ResourceNotFound

func ResourceNotFound(path string, message string) BaseErrorResponse

ResourceNotFound builds and returns a server response object for a resource not found error.

type ValidationErrorResponse

type ValidationErrorResponse struct {
	Message     string              `json:"message"`
	FieldErrors []common.FieldError `json:"fieldErrors"`
	Path        string              `json:"path"`
	Timestamp   time.Time           `json:"timestamp"`
}

ValidationErrorResponse structure.

func ValidationError

func ValidationError(path string, fieldErrors []common.FieldError) ValidationErrorResponse

ValidationError builds and returns a server response object for a validation error.

Jump to

Keyboard shortcuts

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