Documentation
¶
Index ¶
Constants ¶
View Source
const ( // HeaderAcceptLanguage is the HTTP header name for accepted languages. HeaderAcceptLanguage = "Accept-Language" // HeaderContentLanguage is the HTTP header name for the content language. HeaderContentLanguage = "Content-Language" // KeyFirstPage is the key to the links object whose value contains a link to // the first page of data. KeyFirstPage = "first" // KeyLastPage is the key to the links object whose value contains a link to // the last page of data. KeyLastPage = "last" // KeyPreviousPage is the key to the links object whose value contains a link // to the previous page of data. KeyPreviousPage = "prev" // KeyNextPage is the key to the links object whose value contains a link to // the next page of data. KeyNextPage = "next" // KeyTotalPages is the key to the meta object whose value contains the total // pagination pages. KeyTotalPages = "total-pages" )
View Source
const ( // QueryParamPageTotal is the query parameter that marks to get total number instances / pages for the collection. QueryParamPageTotal string = "page[total]" // QueryParamLinks is the query parameter that marks to marshal object links. QueryParamLinks string = "links" )
Variables ¶
This section is empty.
Functions ¶
func AcceptMediaTypeMid ¶
func AcceptMediaTypeMid(next httprouter.Handle) httprouter.Handle
AcceptMediaTypeMid is the middleware that checks if the request contains Header "Accept: application/vnd.api+json".
func New ¶
func New(c *controller.Controller, cfg *config.Router, router ...*httprouter.Router) handler.Handler
New creates new jsonapi Handler.
func UnsupportedMediaTypeMid ¶
func UnsupportedMediaTypeMid(next httprouter.Handle) httprouter.Handle
UnsupportedMediaTypeMid is the middleware that checks if the request contains Header "Content-Type" with media type different then `application/vnd.api+json`
Types ¶
type Handler ¶
Handler is the neuron gateway handler that implements https://jsonapi.org server routes for neuron models.
func (*Handler) Router ¶
func (h *Handler) Router() *httprouter.Router
Router implements handler.Handler interface.
func (*Handler) SetModelRoutes ¶
SetModelRoutes sets the routes for the provided 'model'. The model must be registered within the controller provided in the Handler creator. Implements router.Router interface.
Click to show internal directories.
Click to hide internal directories.