package routes import ( "fmt" "git.trj.tw/golang/go-gallery/models" "github.com/gin-gonic/gin" ) // NewServ - get new service func NewServ() *gin.Engine { r := gin.Default() return r } // SetDefaultRoutes - func SetDefaultRoutes(r *gin.Engine) { r.GET("/", func(c *gin.Context) { accs, err := models.GetAllAccount() if err != nil { c.JSON(500, gin.H{ "message": "db error", }) return } fmt.Println(accs) c.JSON(200, accs) }) }