router
router copied to clipboard
Router don't catch panic
func Index(ctx *fasthttp.RequestCtx) {
ctx.WriteString("Welcome!")
}
func Hello(ctx *fasthttp.RequestCtx) {
fmt.Fprintf(ctx, "Hello, %s!\n", ctx.UserValue("name"))
}
func main() {
r := router.New()
r.GET("/", Index)
r.GET("/{name1}/{name3}", Hello)
r.GET("/{name}/{name3}", Hello)
log.Fatal(fasthttp.ListenAndServe(":8080", r.Handler))
}
Expected catch panic