Consistent pluralization of routes? #1337
Unanswered
redbar0n
asked this question in
Help & Questions
Replies: 1 comment
-
It isn't hardcoded into Vike; the user has full freedom to choose any URL structure he wants. I like the user friendliness of |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Re: #1322 (comment) and https://vike.dev/file-structure :
Maybe it's a good idea to have consistent/uniform pluralization throughout the framework?
Though I'm not entirely sure how hard-coded pluralization of routes is in the framework (or if it's entirely user-defined), or if it's just the documentation that is a bit inconsistent. See:
https://github.com/search?q=repo%3Avikejs%2Fvike+%22products%22&type=code
vs
https://github.com/search?q=repo%3Avikejs%2Fvike+%22%2Fproduct%22&type=code
In any case, I suggest the following.
Either pluralize all url's:
Or have them all in singular:
The less variability the better, since:
products
andproduct
are strictly speaking not two distinct resources, but they are two distinct URI's. Butan application should expose many URIs, one for each resource;
https://en.wikipedia.org/wiki/Resource-oriented_architectureArguments for pluralized:
/products/@id
can be seen as accessing the list of products and getting one with a specific id./products
is more logical than/product
when you want to access the list of products. Unless you interpret the last one as giving you a product index/product/index.html
.Arguments for singular:
SELECT name FROM user
.UsersProducts
).-s
,-es
,-i
,-a
, or just inconvenient to pluralize.It would be harder to change this convention later. V1 design is a good time, imho.
Some related discussions:
https://stackoverflow.com/questions/6845772/should-i-use-singular-or-plural-name-convention-for-rest-resources
https://stackoverflow.com/questions/18570158/handling-singular-and-plural-controllers-routes
https://www.reddit.com/r/AskProgramming/comments/15rxwfd/singular_or_plural_nouns/
kubernetes/kubernetes#18622
Beta Was this translation helpful? Give feedback.
All reactions