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
|
instead of
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
// Default With the Logger and Recovery middleware already attached
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -380,7 +381,10 @@ func main() {
|
|||||||
r := gin.New()
|
r := gin.New()
|
||||||
|
|
||||||
// Global middleware
|
// 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())
|
r.Use(gin.Logger())
|
||||||
|
|
||||||
|
// Recovery middleware recovers from any panics and writes a 500 if there was one.
|
||||||
r.Use(gin.Recovery())
|
r.Use(gin.Recovery())
|
||||||
|
|
||||||
// Per route middleware, you can add as many as you desire.
|
// Per route middleware, you can add as many as you desire.
|
||||||
|
Loading…
Reference in New Issue
Block a user