1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- package api
- import (
- "fmt"
- "github.com/gin-gonic/gin"
- )
- func RegRouters(svc *Service) {
- r := svc.NewGinRouter("/cmf")
- r.group.Use(Logger())
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- r.GET("/getToken", callback)
- r.GETJWT("/r1", func(c *gin.Context, apictx *ApiSession) (interface{}, error) {
- return apictx.User, nil
- })
- CreateCategoryRouter(r)
-
- ModelLib(r)
-
-
- MatLib(r)
-
- Shape(r)
- Finish(r)
- MyCaseRoute(r)
- MyMatLib(r)
- r.GET("/printr", Printr)
- }
- func Logger() gin.HandlerFunc {
- return func(c *gin.Context) {
-
-
-
- c.Next()
-
-
-
-
- path := c.Request.URL.Path
- clientIP := c.ClientIP()
-
-
- out := fmt.Sprintf("%15s=> %s", clientIP, path)
- fmt.Println(out)
- }
- }
|