# structuring/bootstrap 方便的建立起 iris 的脚手架,初始化了session,初始化了程序变量 - 路由单独放出 - 静态文件实例 - 全局中间件实例 - 模板文件实例 #
# 直接注册 ## hander 方法 ```go app.Handle("GET", "/contact", func(ctx iris.Context) { ctx.HTML("

Hello from /contact

") }) ``` ## method 方法 ``` //GET 方法 app.Get("/", handler) // POS
# 中间件实例 ```go func before(ctx iris.Context) { shareInformation := "this is a sharable information between handlers" requestPath := ctx.Path() println("Before the mainHandler:
# 配置中间件 # 方式一 ```go import ( "github.com/kataras/iris/mvc" ) mvc.New(app.Party("/hello")).Handle(new(controllers.HelloController)) ``` ```go // file: web/controllers/hello_controller.go package co
# 配置 main.go ```go tmpl := iris.HTML("./web/views", ".html"). Layout("shared/layout.html"). Reload(true) app.RegisterView(tmpl) app.HandleDir("/public", "./web/public") ``` layout.html ```html