Added middleware documentation
This commit is contained in:
parent
b6fec17b49
commit
b3271e03b7
1 changed files with 11 additions and 0 deletions
11
README.md
11
README.md
|
@ -34,6 +34,17 @@ s.Get("/images/*file", func(ctx web.Context) error {
|
||||||
return ctx.String(ctx.Request().Param("file"))
|
return ctx.String(ctx.Request().Param("file"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Middleware
|
||||||
|
s.Use(func(ctx web.Context) error {
|
||||||
|
start := time.Now()
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
fmt.Println(ctx.Request().Path(), time.Since(start))
|
||||||
|
}()
|
||||||
|
|
||||||
|
return ctx.Next()
|
||||||
|
})
|
||||||
|
|
||||||
s.Run(":8080")
|
s.Run(":8080")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue