1 Star 2 Fork 0

api-go/iris

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
main.go 629 Bytes
Copy Edit Raw Blame History
package main
import (
"github.com/kataras/iris"
"github.com/kataras/iris/context"
"github.com/kataras/iris/middleware/recover"
)
func main() {
app := iris.New()
// use this recover(y) middleware
app.Use(recover.New())
i := 0
// let's simmilate a panic every next request
app.Get("/", func(ctx context.Context) {
i++
if i%2 == 0 {
panic("a panic here")
}
ctx.Writef("Hello, refresh one time more to get panic!")
})
// http://localhost:8080, refresh it 5-6 times.
app.Run(iris.Addr(":8080"))
}
// Note:
// app := iris.Default() instead of iris.New() makes use of the recovery middleware automatically.
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/netscript/iris.git
git@gitee.com:netscript/iris.git
netscript
iris
iris
v8.3.4

Search