Documentation ¶
Index ¶
- type APIGContext
- type APIGHandler
- type APIGRouter
- func (r *APIGRouter) Delete(route string, handlers ...APIGHandler)
- func (r *APIGRouter) Get(route string, handlers ...APIGHandler)
- func (r *APIGRouter) Patch(route string, handlers ...APIGHandler)
- func (r *APIGRouter) Post(route string, handlers ...APIGHandler)
- func (r *APIGRouter) Put(route string, handlers ...APIGHandler)
- func (r *APIGRouter) Respond() events.APIGatewayProxyResponse
- type APIGRouterConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIGContext ¶
type APIGContext struct { Claims map[string]interface{} Context context.Context Path map[string]string QryStr map[string]string Request *events.APIGatewayProxyRequest Status int Body []byte Err error }
APIGContext is used as the input and output of handler functions. The Body, Claims, Path, and QryStr will be populated by the the APIGatewayProxyRequest. The Request itself is also passed through if you need further access. Fill the Status and Body, or Status and Error to respond.
type APIGHandler ¶
type APIGHandler func(ctx *APIGContext)
APIGHandler is the interface a handler function must implement to be used with Get, Post, Put, Patch, and Delete.
type APIGRouter ¶
type APIGRouter struct {
// contains filtered or unexported fields
}
APIGRouter is the object that handlers build upon and is used in the end to respond.
func NewAPIGRouter ¶
func NewAPIGRouter(cfg *APIGRouterConfig) *APIGRouter
NewAPIGRouter creates a new router using the given router config.
func (*APIGRouter) Delete ¶
func (r *APIGRouter) Delete(route string, handlers ...APIGHandler)
Delete creates a new delete endpoint.
func (*APIGRouter) Get ¶
func (r *APIGRouter) Get(route string, handlers ...APIGHandler)
Get creates a new get endpoint.
func (*APIGRouter) Patch ¶
func (r *APIGRouter) Patch(route string, handlers ...APIGHandler)
Patch creates a new patch endpoint
func (*APIGRouter) Post ¶
func (r *APIGRouter) Post(route string, handlers ...APIGHandler)
Post creates a new post endpoint.
func (*APIGRouter) Put ¶
func (r *APIGRouter) Put(route string, handlers ...APIGHandler)
Put creates a new put endpoint.
func (*APIGRouter) Respond ¶
func (r *APIGRouter) Respond() events.APIGatewayProxyResponse
Respond returns an APIGatewayProxyResponse to respond to the lambda request.
type APIGRouterConfig ¶
type APIGRouterConfig struct { Context context.Context Request *events.APIGatewayProxyRequest Prefix string Headers map[string]string }
APIGRouterConfig is used as the input to NewAPIGRouter, request is your incoming apig request and prefix will be stripped of all incoming request paths. Headers will be sent with all responses.