mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
a1232c9a9a
Former-commit-id: d0f5785aff289b8c140e4f253eb555135e79603d
27 lines
608 B
Go
27 lines
608 B
Go
package main
|
|
|
|
import "github.com/kataras/iris"
|
|
|
|
func main() {
|
|
app := iris.New()
|
|
|
|
// this works as expected now,
|
|
// will handle *all* expect DELETE requests, even if there is no routes.
|
|
app.Get("/action/{p}", h)
|
|
|
|
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
|
|
}
|
|
|
|
func h(ctx iris.Context) {
|
|
ctx.Writef("[%s] %s : Parameter = `%s`", ctx.Method(), ctx.Path(), ctx.Params().Get("p"))
|
|
}
|
|
|
|
func fallbackHandler(ctx iris.Context) {
|
|
if ctx.Method() == iris.MethodDelete {
|
|
ctx.NextOrNotFound()
|
|
return
|
|
}
|
|
|
|
ctx.Writef("[%s] %s : From fallback handler", ctx.Method(), ctx.Path())
|
|
}
|