簡體   English   中英

如何在 Grapevine 中創建動態路徑

[英]How do I create dynamic paths in Grapevine

我正在嘗試使用 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

謝謝你的幫助

你真的很親近。 在您的模式中使用方括號而不是花括號。

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

更新:Grapevine 4.x 和更低的方括號用於路由參數。 Grapevine 5+ 使用花括號(就像asp.net)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM