update
This commit is contained in:
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user