mirror of
https://github.com/lzh-1625/go_process_manager.git
synced 2025-10-05 07:56:50 +08:00
add demo model
This commit is contained in:
23
internal/app/middle/demo.go
Normal file
23
internal/app/middle/demo.go
Normal file
@@ -0,0 +1,23 @@
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user