This commit is contained in:
Jay
2018-04-12 17:41:21 +08:00
parent 078461b8cd
commit 5484da1212
5 changed files with 65 additions and 4 deletions
+12 -3
View File
@@ -1,6 +1,9 @@
package routes
import (
"fmt"
"git.trj.tw/golang/go-gallery/models"
"github.com/gin-gonic/gin"
)
@@ -13,8 +16,14 @@ func NewServ() *gin.Engine {
// SetDefaultRoutes -
func SetDefaultRoutes(r *gin.Engine) {
r.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "test",
})
accs, err := models.GetAllAccount()
if err != nil {
c.JSON(500, gin.H{
"message": "db error",
})
return
}
fmt.Println(accs)
c.JSON(200, accs)
})
}