feat:完善信息
This commit is contained in:
@ -3,11 +3,13 @@ package router
|
||||
import (
|
||||
"SciencesServer/config"
|
||||
"SciencesServer/router/rate"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/chenjiandongx/ginprom"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@ -37,18 +39,14 @@ func (this *Router) Init() *gin.Engine {
|
||||
if this.IsCors {
|
||||
app.Use(Cors())
|
||||
}
|
||||
//app.LoadHTMLFiles("./dist/*") // 添加资源路径
|
||||
app.LoadHTMLGlob("./dist/index.html") // 添加资源路径
|
||||
app.StaticFS("/static", http.Dir("./dist/static"))
|
||||
|
||||
app.GET("", func(c *gin.Context) {
|
||||
c.HTML(http.StatusOK, "index.html", nil)
|
||||
})
|
||||
//app.NoRoute(NoRouteHandler())
|
||||
app.NoRoute(NoRouteHandler())
|
||||
app.NoMethod(NoMethodHandler())
|
||||
app.Use(ginprom.PromMiddleware(nil))
|
||||
app.Use(LoggerHandle("log/gin.log", 3))
|
||||
app.Use(TimeoutHandle(time.Second * 30))
|
||||
//app.Use(RecoveryHandler())
|
||||
app.Use(RecoveryHandler())
|
||||
|
||||
app.GET("/metrics", ginprom.PromHandler(promhttp.Handler()))
|
||||
|
||||
if this.RateLimitConfig != nil {
|
||||
if this.RateLimitConfig.IsRate {
|
||||
|
Reference in New Issue
Block a user