Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gosszhang opened this issue Aug 25, 2022 · 0 comments
Open

Comments

@gosszhang
Copy link

路径中带有参数时,当前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文档中路径参数格式就是/{}这样。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant