1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-23 21:07:03 +00:00

Add a simple and pure .Regex middleware for routers that don't support regex route path validations out-of-the-box

Former-commit-id: 84cf1fb267e54543ad6d419b2ca39658b2773b58
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-02-22 00:51:50 +02:00
parent 51c74b5bb6
commit 42cf24fda2
10 changed files with 132 additions and 81 deletions

View File

@@ -496,6 +496,11 @@ func formatPath(path string) string {
return path
}
// Name is the name of the router
//
// See $iris_instance.Config.Other for more.
const Name = "httprouter"
// New returns a new iris' policy to create and attach the router.
// It's based on the julienschmidt/httprouter with more features and some iris-relative performance tips:
// subdomains(wildcard/dynamic and static) and faster parameters set (use of the already-created context's values)
@@ -512,6 +517,7 @@ func New() iris.Policies {
EventPolicy: iris.EventPolicy{
Boot: func(s *iris.Framework) {
logger = s.Log
s.Set(iris.OptionOther(iris.RouterNameConfigKey, Name))
},
},
RouterReversionPolicy: iris.RouterReversionPolicy{