1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-24 05:43:57 +00:00
fiber/middleware/recover.md
2020-06-08 03:52:09 +02:00

533 B

Recover

Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized ErrorHandler.

Example

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

func Recover() fiber.Handler {}