package web import ( "net/http" "github.com/gin-gonic/gin" "th7/ports" ) type GinAdapter struct { router *gin.Engine corePort ports.CorePort } func (g GinAdapter) registerEndpoints() { g.router.GET("/", func(c *gin.Context) { c.JSON(http.StatusOK, g.corePort.GetAll()) }) } func NewGinAdapter(corePort ports.CorePort) *GinAdapter { var adapter GinAdapter adapter.corePort = corePort adapter.router = gin.Default() adapter.registerEndpoints() return &adapter } func (g *GinAdapter) Run() { g.router.Run() }