mirror of
https://github.com/lzh-1625/go_process_manager.git
synced 2025-10-05 16:06:51 +08:00
24 lines
390 B
Go
24 lines
390 B
Go
package middle
|
|
|
|
import (
|
|
"net/http"
|
|
"slices"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// 演示模式
|
|
func DemoMiddle() func(c *gin.Context) {
|
|
return func(ctx *gin.Context) {
|
|
whiteListUri := []string{
|
|
"/api/user/login",
|
|
"/api/log",
|
|
}
|
|
if ctx.Request.Method == http.MethodGet || slices.Contains(whiteListUri, ctx.Request.URL.String()) {
|
|
ctx.Next()
|
|
} else {
|
|
ctx.Abort()
|
|
}
|
|
}
|
|
}
|