1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-09 21:15:56 +00:00
Former-commit-id: 5576c44b64014fb00dd79e618b815b5f52b705e4
This commit is contained in:
Gerasimos Maropoulos
2018-03-10 14:22:56 +02:00
parent 1165b4527a
commit 4993918a12
11 changed files with 131 additions and 364 deletions

View File

@@ -1,29 +0,0 @@
package main
import "github.com/kataras/iris"
func main() {
app := iris.New()
// add a fallback handler to process requests that would not be declared in the router.
app.Fallback(fallbackHandler)
// 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())
}