Documentation
¶
Index ¶
- func DecoderErr(err error) error
- type AppHandler
- func (ah *AppHandler) AddMovie(w http.ResponseWriter, r *http.Request)
- func (ah *AppHandler) AddStandardResponseHeaders(h http.Handler) http.Handler
- func (ah *AppHandler) DeleteMovie(w http.ResponseWriter, r *http.Request)
- func (ah *AppHandler) FindAll(w http.ResponseWriter, r *http.Request)
- func (ah *AppHandler) FindByID(w http.ResponseWriter, r *http.Request)
- func (ah *AppHandler) SetAccessToken2Context(h http.Handler) http.Handler
- func (ah *AppHandler) SetStandardResponseFields(h http.Handler) http.Handler
- func (ah *AppHandler) UpdateMovie(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecoderErr ¶ added in v0.17.0
When an error is returned by json.NewDecoder(r.Body).Decode(&data) this function will determine the appropriate error response
Types ¶
type AppHandler ¶ added in v0.12.0
type AppHandler struct {
App *app.Application
controller.StandardResponseFields
}
AppHandler is the struct that serves the application and methods for handling all HTTP requests
func NewAppHandler ¶ added in v0.13.0
func NewAppHandler(app *app.Application) *AppHandler
NewAppHandler initializes the AppHandler
func (*AppHandler) AddMovie ¶ added in v0.12.0
func (ah *AppHandler) AddMovie(w http.ResponseWriter, r *http.Request)
AddMovie handles POST requests for the /movies endpoint and creates a movie in the database
func (*AppHandler) AddStandardResponseHeaders ¶ added in v0.12.0
func (ah *AppHandler) AddStandardResponseHeaders(h http.Handler) http.Handler
AddStandardResponseHeaders middleware is used to add any standard HTTP response headers. All of the responses for this app have a JSON based response body
func (*AppHandler) DeleteMovie ¶ added in v0.18.0
func (ah *AppHandler) DeleteMovie(w http.ResponseWriter, r *http.Request)
DeleteMovie handles DELETE requests for the /movies/{id} endpoint and updates the given movie
func (*AppHandler) FindAll ¶ added in v0.13.0
func (ah *AppHandler) FindAll(w http.ResponseWriter, r *http.Request)
FindAll handles GET requests for the /movies endpoint and finds all movies
func (*AppHandler) FindByID ¶ added in v0.12.0
func (ah *AppHandler) FindByID(w http.ResponseWriter, r *http.Request)
FindByID handles GET requests for the /movies/{id} endpoint and finds a movie by it's ID
func (*AppHandler) SetAccessToken2Context ¶ added in v0.18.0
func (ah *AppHandler) SetAccessToken2Context(h http.Handler) http.Handler
SetAccessToken2Context middleware is used to set the Google access token to the context
func (*AppHandler) SetStandardResponseFields ¶ added in v0.16.0
func (ah *AppHandler) SetStandardResponseFields(h http.Handler) http.Handler
SetStandardResponseFields middleware is used to set the fields that are part of every response
func (*AppHandler) UpdateMovie ¶ added in v0.18.0
func (ah *AppHandler) UpdateMovie(w http.ResponseWriter, r *http.Request)
UpdateMovie handles PUT requests for the /movies/{id} endpoint and updates the given movie