package api import ( "github.com/gin-gonic/gin" ) func (api *Api) defineRoutes() { api.Router.GET("/ping", func(c *gin.Context) { c.JSON(200, gin.H{ "message": "pong", }) }) } func (api *Api) serve(address string) { api.Router = gin.Default() api.Router.Run(address) } func (api *Api) Run() { api.defineRoutes() api.serve(":8080") }