Documentation
¶
Index ¶
- Constants
- Variables
- func FinalizeGinEngine(router *gin.Engine, pathPrefix string)
- func RegisterApiEndpoint(method uint, relativePath string, handler *gin.HandlerFunc) error
- func RegisterApiEndpointJSON(method uint, relativePath string, handler HandlerFuncJSON) error
- type HandlerFuncJSON
- type LessContext
Constants ¶
View Source
const ( HTTP_METHOD_GET uint = iota HTTP_METHOD_POST )
Variables ¶
View Source
var ( ErrNotAllowDirectFuncReg error = errors.New("api.RegisterApiEndpoint(): no direct handler func registration is allowed") ErrBadMethod error = errors.New("api.RegisterApiEndpoint(): bad method") ErrRepeatGetPath error = errors.New("api.RegisterApiEndpoint(): repeated path for GET method") ErrRepeatPostPath error = errors.New("api.RegisterApiEndpoint(): repeated path for POST method") )
Functions ¶
func FinalizeGinEngine ¶ added in v0.0.3
func RegisterApiEndpoint ¶
func RegisterApiEndpoint(method uint, relativePath string, handler *gin.HandlerFunc) error
RegisterNewAPIEndpoint() allows only one single handler function, unlike with direct Gin.Router access.
func RegisterApiEndpointJSON ¶
func RegisterApiEndpointJSON(method uint, relativePath string, handler HandlerFuncJSON) error
This function should wrap the JSON and StatCode returned from handler, register it
Types ¶
type HandlerFuncJSON ¶
type HandlerFuncJSON func(*LessContext) (status int, json gin.H)
type LessContext ¶
TODO: Add more safe-to-expose access
Click to show internal directories.
Click to hide internal directories.