关于人们如何在 REST 中使用 URI,我已经看到了很多不同的答案。我倾向于对集合使用复数,对单一资源使用单数。但它需要更多的路由。
可以对所有资源使用复数吗?例如:
GET /ressources // to all ressources
GET /ressources/{id} // to get one ressource
DELETE /ressources/{id} // to delete one ressource
还是我应该坚持:
GET /ressources
GET /ressource/{id}
DELETE /ressource/{id}
它在所有情况下都有效吗?在这种情况下,最佳做法是什么?