From c70ce0da2c11f72e11085c48c9dcf2e73de1f209 Mon Sep 17 00:00:00 2001 From: EwenQuim Date: Wed, 21 Feb 2024 09:15:01 +0100 Subject: [PATCH] docs: fixed middleware documentation --- documentation/docs/guides/middlewares.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/documentation/docs/guides/middlewares.md b/documentation/docs/guides/middlewares.md index 02dc4f2e..ae06d8db 100644 --- a/documentation/docs/guides/middlewares.md +++ b/documentation/docs/guides/middlewares.md @@ -22,7 +22,7 @@ func main() { s := fuego.NewServer() // Add a middleware to the whole server - fuego.Use(func(s, next http.Handler) http.Handler { + fuego.Use(s, func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // Do something before the request next.ServeHTTP(w, r) @@ -30,6 +30,8 @@ func main() { }) }) + fuego.Use(s, myMiddleware) + fuego.Get(s, "/", myController) s.Run()