package
3.0.0-beta+incompatible
Repository: https://github.com/azber/iris.git
Documentation: pkg.go.dev

# README

Middleware information

This folder contains a middleware for safety recover the server from panic

How to use


package main

import (
	"github.com/kataras/iris"
	"github.com/kataras/iris/middleware/recovery"
	"os"
)

func main() {

	iris.Use(recovery.New(os.Stderr)) // optional parameter is the writer which the stack of the panic will be printed

	iris.Get("/", func(ctx *iris.Context) {
		ctx.Write("Hi, let's panic")
		panic("errorrrrrrrrrrrrrrr")
	})

	println("Server is running at :8080")
	iris.Listen(":8080")
}

# Functions

New restores the server on internal server errors (panics) receives an optional writer, the default is the os.Stderr if no out writer given returns the middleware as iris.Handler same as Recovery(...).
Recovery restores the server on internal server errors (panics) receives an optional writer, the default is the os.Stderr if no out writer given returns the middleware as iris.Handler same as New(...).