Skip to content

Commit

Permalink
feat(main): 增加path匹配器测试demo
Browse files Browse the repository at this point in the history
  • Loading branch information
BadKid90s committed Apr 24, 2024
1 parent 25806a6 commit 5345045
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions example/matcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func main() {
context.Next()
})

//添加带路径匹配器的自定义中间件
chain.UseMatcher(matcher.PathPrefix("/hello"), func(context *knife.Context) {
log.Println("pathPrefix matcher")
context.Next()
})

//启动服务
_ = http.ListenAndServe(":8080", chain)
}

0 comments on commit 5345045

Please sign in to comment.