r := gin.Default()
Default() function returns *Engine. but r calls a function on RouterGroup.
ex)
r.GET("/api/healthcheck", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "hi",
})
})
Definition
// Engine is the framework's instance, it contains the muxer, middleware and configuration settings.
// Create an instance of Engine, by using New() or Default()
type Engine struct {
RouterGroup
// RouterGroup is used internally to configure router, a RouterGroup is associated with
// a prefix and an array of handlers (middleware).
type RouterGroup struct {
Handlers HandlersChain
basePath string
engine *Engine
root bool
}
Can you explain how this works? what syntax is it