add a small convert net/http.Handler to iris.Handler section at the Routing-middleware

Gerasimos (Makis) Maropoulos 2019-07-03 00:49:46 +03:00
parent 55d42e7d57
commit 2be60fea82
No known key found for this signature in database
GPG Key ID: F169457BBDA4ACF4
2 changed files with 10 additions and 3 deletions

@ -18,7 +18,7 @@ This wiki is the main source of documentation for **developers** working with (o
* [[Dependency Injection|Routing-dependency-injection]] * [[Dependency Injection|Routing-dependency-injection]]
* [[Cookies]] * [[Cookies]]
> This new wiki is a` Work In Progress` in an effort to centralize the documentation and concepts explanation to a single place. > This new wiki is a `Work In Progress` in an effort to centralize the documentation and concepts explanation into a single place.
## Runnable Examples ## Runnable Examples

@ -116,9 +116,16 @@ app.SetExecutionRules(iris.ExecutionRules{
}) })
``` ```
--------------------- ## Convert `http.Handler/HandlerFunc`
Any third-party middleware that written for `net/http` is automatic compatible with Iris using the `iris.FromStd(aThirdPartyMiddleware)`. Remember, `ctx.ResponseWriter()` and `ctx.Request()` returns the same `net/http` input arguments for an `http.Handler`. See [here](https://github.com/kataras/iris/tree/master/_examples/convert-handlers) for an example. Any third-party middleware that written for `net/http` is automatic compatible with Iris using the `iris.FromStd(aThirdPartyMiddleware)`. Remember, `ctx.ResponseWriter()` and `ctx.Request()` returns the same `net/http` input arguments for an `http.Handler`.
- [From func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)](convert-handlers/negroni-like/main.go)
- [From http.Handler or http.HandlerFunc](convert-handlers/nethttp/main.go)
- [From func(http.HandlerFunc) http.HandlerFunc](convert-handlers/real-usecase-raven/writing-middleware/main.go)
---------------------
Here is a list of some handlers made specifically for Iris: Here is a list of some handlers made specifically for Iris: