<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] > [github的官方提供案例](https://github.com/kataras/iris/tree/master/_examples) > [中文參考文檔](https://studyiris.com/example/) ## 安裝 ` go get -u github.com/kataras/iris` ## 快速入門 ``` func main() { app :=iris.New() app.Get("/", func(c iris.Context) { c.WriteString("hello word") }) //模板輸出 app.RegisterView(iris.HTML("./",".html")) app.Get("/hello", func(c iris.Context) { c.ViewData("title","this is a iris") c.ViewData("content","this is a content") c.View("hello.html") }) app.Run(iris.Addr(":8080")) } ``` ## url 策略 ``` /users/{id:uint64} /users/123 -> 123 /users/{id:path} /users/abc/123 -> abc/123 /users/{id:uint64} min(2) /users/123 -> 123 /users/{id:string prefix(a_)} /users/a_123 -> a_123 ``` ## 路由分組 ``` order := app.Party("/v1/order") { order.Post("/create",postFunc) order.Post("/update",putFunc) order.Post("/delete",deketeFunc) } ``` ### 路由分組的中間件 ``` v1 := app.Party("/v1/order") v1.Use(func(ctx iris.Context) { logrus.Info("自定義中間件") ctx.Next() }) { v1.Get("/create",hand) v1.Get("/update",hand) v1.Get("/delete",hand) } ``` ## 定義錯誤信息 ``` //任何錯誤信息都返回 此錯誤 app.OnAnyErrorCode(func(ctx iris.Context) { ctx.WriteString("see is error") }) //根據狀態碼返回錯誤 app.OnErrorCode(httptest.StatusInternalServerError, func(ctx iris.Context) { ctx.WriteString("服務器內部錯誤") }) ``` ## 異常恢復 ``` ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看