<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## 注冊路由規則 路由注冊可以直接定義路由定義文件的方式進行集中注冊,在文件`routes/api.go`中,它使用的是基于`gin`框架的路由包,如果你熟悉`gin`框架,那么它對你來說是非常容易的。 請求類型包括: | 類型 | 描述 | | --- | --- | | GET | GET請求 | | POST | POST請求 | | PUT | PUT請求 | | DELETE | DELETE請求 | **注意,路由命名標識必須唯一,定義后可以用于URL的快速生成。** ``` r.GET("/", func(c *gin.Context) {c.JSON(200, "Hello,world!")}) // 一個GET請求路由方法 r.POST("/", func(c *gin.Context) {c.JSON(200, "Hello,world!")}) // 一個POST請求路由方法 r.PUT("/", func(c *gin.Context) {c.JSON(200, "Hello,world!")}) // 一個PUT請求路由方法 r.DELETE("/", func(c *gin.Context) {c.JSON(200, "Hello,world!")}) // 一個DELETE請求路由方法 ``` ## 指向到控制器方法 以下示例是將`/index`路由指向到`BaseAPIController`控制器下的`Index`方法,注意因`Go`語言特性,公開的方法并首字母必須`大寫` ``` controller := new(BaseAPIController) v1.GET("/index", controller.Index) ``` `Index`中的 示例代碼: ~~~ func (lc *BaseAPIController) Index(c *gin.Context) { c.JSON(200, "Hello World") } ~~~ 這是一個非常簡單的方法,實際訪問的路由地址是: `http://127.0.0.1:3000/v1/index` 它會輸出`Hello World`
                  <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>

                              哎呀哎呀视频在线观看