doc(readme): add additional middleware doc. (#1056)
This commit is contained in:
parent
a8fa424ae5
commit
3856206bd0
@ -369,6 +369,7 @@ r := gin.New()
|
||||
instead of
|
||||
|
||||
```go
|
||||
// Default With the Logger and Recovery middleware already attached
|
||||
r := gin.Default()
|
||||
```
|
||||
|
||||
@ -380,7 +381,10 @@ func main() {
|
||||
r := gin.New()
|
||||
|
||||
// Global middleware
|
||||
// Logger middleware will write the logs to gin.DefaultWriter even you set with GIN_MODE=release. By default gin.DefaultWriter = os.Stdout
|
||||
r.Use(gin.Logger())
|
||||
|
||||
// Recovery middleware recovers from any panics and writes a 500 if there was one.
|
||||
r.Use(gin.Recovery())
|
||||
|
||||
// Per route middleware, you can add as many as you desire.
|
||||
|
Loading…
Reference in New Issue
Block a user