42 lines
1.0 KiB
Go
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))
|
|
}
|