What are the url parameters naming convention or standards to follow

前端 未结 6 991
情书的邮戳
情书的邮戳 2021-01-31 14:29

Are there any naming conventions or standards for Url parameters to be followed. I generally use camel casing like userId or itemNumber. As I am about

6条回答
  •  孤独总比滥情好
    2021-01-31 15:24

    Standard for URI are defined by RFC2396.
    Anything after the standardized portion of the URL is left to you.

    You probably only want to follow a particular convention on your parameters based on the framework you use.
    Most of the time you wouldn't even really care because these are not under your control, but when they are, you probably want to at least be consistent and try to generate user-friendly bits:

    • that are short,
    • if they are meant to be directly accessible by users, they should be easy to remember,
    • case-insensitive (may be hard depending on the server OS).
    • follow some SEO guidelines and best practices, they may help you a lot.

    I would say that cleanliness and user-friendliness are laudable goals to strive for when presenting URLs.
    StackOverflow does a fairly good job of it.

提交回复
热议问题