package api import ( db "git.nochill.in/nochill/naice_pos/db/sqlc" "github.com/gin-gonic/gin" ) type Server struct { store db.Store router *gin.Engine } func NewServer(store db.Store) *Server { server := &Server{store: store} router := gin.Default() router.POST("/merchants", server.createUser) router.POST("/products", server.createProduct) router.PATCH("/products", server.updateProduct) router.GET("/product/:id", server.getProduct) router.POST("/suppliers", server.createSupplier) router.POST("/purchase-products", server.createPurchase) server.router = router return server } func (server *Server) Start(address string) error { return server.router.Run(address) }