1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-24 17:24:08 +00:00
fiber/middleware/recover.md

30 lines
533 B
Markdown
Raw Normal View History

2020-06-08 03:52:09 +02:00
# Recover
Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized [ErrorHandler](https://docs.gofiber.io/error-handling).
### Example
```go
package main
import (
"github.com/gofiber/fiber"
"github.com/gofiber/fiber/middleware"
)
func main() {
app := fiber.New()
app.Use(middleware.Recover())
app.Get("/", func(c *fiber.Ctx) {
panic("normally this would crash your app")
})
app.Listen(3000)
}
```
### Signatures
```go
func Recover() fiber.Handler {}
```