gateway/main.go
李寻欢 8fa00be3c5
Some checks failed
continuous-integration/drone/push Build is failing
🐛 修复指定运行端口无效的BUG
2021-09-09 10:34:29 +08:00

42 lines
1.0 KiB
Go

package main
import (
"fmt"
"gateway/config"
"gateway/core"
"gateway/initialization"
"gateway/middleware"
"github.com/gin-gonic/gin"
)
func main() {
// 初始化系统
initialization.InitSystem()
// 创建默认Web服务
app := gin.Default()
app.Use(middleware.GenRequestId(), middleware.OpenTracing())
app.Any("/*action", core.NacosClient.Remote)
//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))
//})
_ = app.Run(fmt.Sprintf(":%v", config.AppInfo.Port))
}