http

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: May 19, 2018 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandlerGetResourceID

func HandlerGetResourceID(fn func(*http.Request) string) func(*Handler)

HandlerGetResourceID set the function used to fetch the resourceID from the URL.

func HandlerGetResourceURI

func HandlerGetResourceURI(fn func(string) string) func(*Handler)

HandlerGetResourceURI set the function used to generate the URI for a resource.

func HandlerParsePagination

func HandlerParsePagination(fn func(r *http.Request) (*flare.Pagination, error)) func(*Handler)

HandlerParsePagination set the function used to parse the pagination.

func HandlerRepository

func HandlerRepository(repo flare.ResourceRepositorier) func(*Handler)

HandlerRepository set the repository to access the resources.

func HandlerWriter

func HandlerWriter(writer *infraHTTP.Writer) func(*Handler)

HandlerWriter set the function that return the content to client.

Types

type Handler

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

Handler implements the HTTP handler to manage resources.

func NewHandler

func NewHandler(options ...func(*Handler)) (*Handler, error)

NewHandler initialize the service to handle HTTP requests.

func (*Handler) Create

func (h *Handler) Create(w http.ResponseWriter, r *http.Request)

Create receive the request to create a resource.

func (*Handler) Delete

func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)

Delete receive the request to delete a resource.

func (*Handler) Index

func (h *Handler) Index(w http.ResponseWriter, r *http.Request)

Index receive the request to list the resources.

func (*Handler) Show

func (h *Handler) Show(w http.ResponseWriter, r *http.Request)

Show receive the request to show a resource.

Jump to

Keyboard shortcuts

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