-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustomer.go
54 lines (35 loc) · 964 Bytes
/
customer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import(
"github.com/gin-gonic/gin"
// "net/http"
"fecshop.com/module/user"
_ "fmt"
_ "github.com/go-sql-driver/mysql"
)
func main() {
r := gin.Default()
v1 := r.Group("/v1")
{
// 查询部分
v1.GET("/users", user.List)
v1.POST("/users", user.AddOne)
v1.PATCH("/users/:id", user.UpdateById)
v1.DELETE("/users/:id", user.DeleteById)
}
/*
//r.GET("/customer/account/login", f_customer.AccountLogin)
//r.GET("/customer/account/register", f_customer.AccountRegister)
r.GET("/ping", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "pong",
})
})
r.GET("/customer", func(c *gin.Context){
c.JSON(http.StatusOK, gin.H{
"customer": "terry",
})
})
*/
r.Run("120.24.37.249:3000") // listen and serve on 0.0.0.0:8080
}
// http://blog.csdn.net/rambo_huang/article/details/60604924