From 2be60fea8232d1bf4570d45cfa59927d60291a3e Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Wed, 3 Jul 2019 00:49:46 +0300 Subject: [PATCH] add a small convert net/http.Handler to iris.Handler section at the Routing-middleware --- Home.md | 2 +- Routing-middleware.md | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Home.md b/Home.md index a8fad03..50db00a 100644 --- a/Home.md +++ b/Home.md @@ -18,7 +18,7 @@ This wiki is the main source of documentation for **developers** working with (o * [[Dependency Injection|Routing-dependency-injection]] * [[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 diff --git a/Routing-middleware.md b/Routing-middleware.md index aa9f530..c1b887b 100644 --- a/Routing-middleware.md +++ b/Routing-middleware.md @@ -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: