我正在为Intranet应用程序设计基于HTTP的API.我意识到这是一个非常小的问题,在宏观方案中,但是:我应该使用连字符,下划线或camelCase来分隔URI中的单词吗?
以下是我最初的想法:
骆驼香烟盒
连字符号
下划线
对于一切我都倾向于下划线.大多数大型玩家使用它们的事实令人信服(参见/sf/answers/42592091/).
我们可以Route在ASP.NET Core 的模板中使用破折号(-)吗?
// GET: api/customers/5/orders?active-orders=true
[Route("customers/{customer-id}/orders")]
public IActionResult GetCustomerOrders(int customerId, bool activeOrders)
{
.
.
.
}
Run Code Online (Sandbox Code Playgroud)
(以上代码无效)