mirror of
https://github.com/FJurmanovic/wallet-go-api.git
synced 2026-02-06 06:08:16 +00:00
starter
This commit is contained in:
21
pkg/controllers/api.go
Normal file
21
pkg/controllers/api.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"wallet-api/pkg/services"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ApiController struct {
|
||||
ApiService *services.ApiService
|
||||
}
|
||||
|
||||
func (ac *ApiController) Init(s *gin.Engine) {
|
||||
apiGroup := s.Group("/api")
|
||||
apiGroup.GET("", ac.getFirst)
|
||||
}
|
||||
|
||||
func (ac *ApiController) getFirst(c *gin.Context) {
|
||||
apiModel := ac.ApiService.GetFirst()
|
||||
c.JSON(200, apiModel)
|
||||
}
|
||||
Reference in New Issue
Block a user