【问题标题】:How do I create dynamic paths in Grapevine如何在 Grapevine 中创建动态路径
【发布时间】:2019-04-12 18:43:13
【问题描述】:

我正在尝试使用 Grapevine 创建一个 RESTFUL API。 我想创建动态路径,例如

[RestRoute(PathInfo = "api/eshare/getcustomersbyname/{namepart}", HttpMethod = HttpMethod.GET)]

目的是搜索所有存在{namepart}的客户并返回json。

当我在浏览器中输入http://localhost:2000/api/eshare/getcustomersbyname/bio 时,我总是得到:Route not Found for GET api/eshare/getcustomersbyname

感谢帮助

【问题讨论】:

    标签: grapevine


    【解决方案1】:

    你真的很亲密。在你的模式中使用方括号而不是花括号。

    [RestRoute(PathInfo = "api/eshare/getcustomersbyname/[namepart]", HttpMethod = HttpMethod.GET)]
    

    更新:Grapevine 4.x 及更低版本的路由参数使用方括号。 Grapevine 5+ 使用花括号(就像 asp.net)

    【讨论】:

      猜你喜欢
      • 2023-03-16
      • 1970-01-01
      • 2022-01-09
      • 2018-03-12
      • 1970-01-01
      • 1970-01-01
      • 2019-06-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多