Skip to content

Commit

Permalink
docs: fixed middleware documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
EwenQuim committed Feb 21, 2024
1 parent ea28bd0 commit c70ce0d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion documentation/docs/guides/middlewares.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ 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)
// Do something after the request
})
})

fuego.Use(s, myMiddleware)

fuego.Get(s, "/", myController)

s.Run()
Expand Down

0 comments on commit c70ce0d

Please sign in to comment.