mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 10:27:06 +00:00
add Party.RemoveRoute method as requested in the community chat
This commit is contained in:
24
_examples/routing/remove-route/main.go
Normal file
24
_examples/routing/remove-route/main.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
app.Get("/", index)
|
||||
app.Get("/about", about).SetName("about_page")
|
||||
app.RemoveRoute("about_page")
|
||||
|
||||
// http://localhost:8080
|
||||
// http://localhost:8080/about (Not Found)
|
||||
app.Listen(":8080")
|
||||
}
|
||||
|
||||
func index(ctx iris.Context) {
|
||||
ctx.WriteString("Hello, Gophers!")
|
||||
}
|
||||
|
||||
func about(ctx iris.Context) {
|
||||
ctx.HTML("<h1>About Page</h1>")
|
||||
}
|
||||
Reference in New Issue
Block a user