routers

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2016 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNoteToRecipePost

func AddNoteToRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

func AttachToRecipePost

func AttachToRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

func CreateRecipe

func CreateRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

CreateRecipe handles rendering the create recipe screen

func CreateRecipePost

func CreateRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

CreateRecipePost handles processing the supplied form input from the create recipe screen

func DeleteRecipe

func DeleteRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

DeleteRecipe handles deleting the recipe with the given id

func EditRecipe

func EditRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

EditRecipe handles rendering the edit recipe screen

func EditRecipePost

func EditRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

EditRecipePost handles processing the supplied form input from the edit recipe screen

func GetRecipe

func GetRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

GetRecipe handles retrieving and rendering a single recipe

func Home

func Home(resp http.ResponseWriter, req *http.Request)

Home handles rending the default home page

func InternalServerError

func InternalServerError(resp http.ResponseWriter, err error)

InternalServerError handles 500 errors

func ListRecipes

func ListRecipes(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

ListRecipes handles retrieving and rending a list of available recipes

func NotFound

func NotFound(resp http.ResponseWriter, req *http.Request)

NotFound handles 404 errors

func RedirectIfHasError

func RedirectIfHasError(resp http.ResponseWriter, err error) bool

RedirectIfHasError sends the request to the InternalServerError page if the asupplied error is not nil

Types

type AttachmentForm

type AttachmentForm struct {
	FileName    string                `form:"file_name"`
	FileContent *multipart.FileHeader `form:"file_content"`
}

AttachmentForm encapsulates user input for attaching a file (image) to a recipe

func (*AttachmentForm) FieldMap added in v0.2.0

func (f *AttachmentForm) FieldMap(req *http.Request) binding.FieldMap

type NoteForm

type NoteForm struct {
	Note string `form:"note"`
}

NoteForm encapsulates user input for a note on a recipe

func (*NoteForm) FieldMap added in v0.2.0

func (f *NoteForm) FieldMap(req *http.Request) binding.FieldMap

type RecipeForm

type RecipeForm struct {
	Name        string   `form:"name"`
	Description string   `form:"description"`
	Ingredients string   `form:"ingredients"`
	Directions  string   `form:"directions"`
	Tags        []string `form:"tags"`
}

RecipeForm encapsulates user input on the Create and Edit recipe screens

func (*RecipeForm) FieldMap added in v0.2.0

func (f *RecipeForm) FieldMap(req *http.Request) binding.FieldMap

Jump to

Keyboard shortcuts

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