gateway/main.go

40 lines
1012 B
Go
Raw Normal View History

2021-08-31 09:39:38 +08:00
package main
import (
2021-09-07 13:40:44 +08:00
"gateway/core"
"gateway/initialization"
"gateway/middleware"
2021-08-31 09:39:38 +08:00
"github.com/gin-gonic/gin"
)
func main() {
2021-09-07 13:40:44 +08:00
// 初始化系统
initialization.InitSystem()
// 创建默认Web服务
2021-08-31 09:39:38 +08:00
app := gin.Default()
2021-09-07 13:40:44 +08:00
app.Use(middleware.GenRequestId(), middleware.OpenTracing())
2021-08-31 09:39:38 +08:00
2021-09-07 13:40:44 +08:00
app.Any("/*action", core.NacosClient.Remote)
2021-08-31 09:39:38 +08:00
2021-09-07 13:40:44 +08:00
//app.GET("/hello", func(context *gin.Context) {
// dd := context.GetString("UberTraceId")
// //log.Println("数据是否存在: ", boo)
// //if boo {
// // log.Println(dd)
// //}
// context.String(http.StatusOK, get("get", context.Request.RequestURI, context.GetString("X-Request-Id"), dd))
//})
//
//app.POST("/hello", func(context *gin.Context) {
// context.String(http.StatusOK, post(context.Request.RequestURI))
//})
//
//app.GET("/ip", func(context *gin.Context) {
// dd := context.GetString("UberTraceId")
// context.String(http.StatusOK, get("get", context.Request.RequestURI, context.GetString("X-Request-Id"), dd))
//})
2021-08-31 09:39:38 +08:00
2021-09-07 13:40:44 +08:00
_ = app.Run(":8889")
2021-08-31 09:39:38 +08:00
}