gpt4 book ai didi

routes - 可选整数参数的 Nancy 路由

转载 作者:行者123 更新时间:2023-12-01 22:24:43 24 4
gpt4 key购买 nike

我想要合并两条路由 Get["/"]Get["/{value:int}"]

如何?

Get["/{value?:int}"]Get["/{value:int?}"] 返回 404 错误。

最佳答案

我发现您可以为多个 GET 定义(或任何 HTTP 动词)分配相同的方法:

Get["/"] = Get["/{value:int}"] = _ => { // method here }

最终结果是相同的,尽管不是一个优雅的结果。

关于routes - 可选整数参数的 Nancy 路由,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23748020/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com