Skip to content

bee generate routers 支持/{*}这种形式生成路由也能正常访问 #836

Description

@gosszhang

路径中带有参数时,当前bee generate routers 只支持 /:* 这种格式生成路由,如果换成 /{*} ,能生成路由,但是访问是404。
示例:
路由注释一:

// @router      /project/:id [get]

生成路由是:

            Method: "GetOne",
            Router: `/project/:id`,
            AllowHTTPMethods: []string{"get"},
            MethodParams: param.Make(),

使用 /project/1 访问,正常

路由注释二:

// @router      /project/{id} [get]

生成路由是:

            Method: "GetOne",
            Router: `/project/{id}`,
            AllowHTTPMethods: []string{"get"},
            MethodParams: param.Make(),

使用 /project/1 访问,报错404

是否考虑支持/{} 生成的路由也能访问。swagger文档中路径参数格式就是/{}这样。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions