diff --git a/example/matcher/main.go b/example/matcher/main.go index 477df7c..f6dbe3e 100644 --- a/example/matcher/main.go +++ b/example/matcher/main.go @@ -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) }