mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 18:37:05 +00:00
@@ -4,7 +4,7 @@ import (
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
func main() {
|
||||
func newApp() *iris.Application {
|
||||
app := iris.New()
|
||||
v1 := app.Party("/api/v1")
|
||||
|
||||
@@ -15,7 +15,8 @@ func main() {
|
||||
}
|
||||
|
||||
onlyWhenFilter1 := func(ctx iris.Context) {
|
||||
ctx.Application().Logger().Infof("admin: %s", ctx.Params())
|
||||
ctx.Application().Logger().Infof("admin: %#+v", ctx.URLParams())
|
||||
ctx.Writef("<title>Admin</title>\n")
|
||||
ctx.Next()
|
||||
}
|
||||
|
||||
@@ -43,6 +44,12 @@ func main() {
|
||||
ctx.HTML("requested: <b>/api/v1/users</b>")
|
||||
})
|
||||
|
||||
return app
|
||||
}
|
||||
|
||||
func main() {
|
||||
app := newApp()
|
||||
|
||||
// http://localhost:8080/api/v1/users
|
||||
// http://localhost:8080/api/v1/users?admin=true
|
||||
app.Run(iris.Addr(":8080"))
|
||||
|
||||
Reference in New Issue
Block a user