mirror of
https://github.com/FJurmanovic/wallet-go-api.git
synced 2026-02-06 06:08:16 +00:00
26 lines
438 B
Go
26 lines
438 B
Go
package controllers
|
|
|
|
import (
|
|
"wallet-api/pkg/services"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type ApiController struct {
|
|
ApiService *services.ApiService
|
|
}
|
|
|
|
func NewApiController(as *services.ApiService, s *gin.RouterGroup) *ApiController {
|
|
ac := new(ApiController)
|
|
ac.ApiService = as
|
|
|
|
s.GET("", ac.getFirst)
|
|
|
|
return ac
|
|
}
|
|
|
|
func (ac *ApiController) getFirst(c *gin.Context) {
|
|
apiModel := ac.ApiService.GetFirst()
|
|
c.JSON(200, apiModel)
|
|
}
|