Hyphen, underscore, or camelCase as word delimiter in URIs?

后端 未结 6 1398
别跟我提以往
别跟我提以往 2020-12-04 04:07

I\'m designing an HTTP-based API for an intranet app. I realize it\'s a pretty small concern in the grand scheme of things, but: should I use hyphens, underscores, o

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 05:08

    Whilst I recommend hyphens, I shall also postulate an answer that isn't on your list:

    Nothing At All

    • My company's API has URIs like /quotationrequests/, /purchaseorders/ and so on.
    • Despite you saying it was an intranet app, you listed SEO as a benefit. Google does match the pattern /foobar/ in a URL for a query of ?q=foo+bar
    • I really hope you do not consider executing a PHP call to any arbitrary string the user passes in to the address bar, as @ServAce85 suggests!

提交回复
热议问题