The naming of things

· Björn-Eric's Developer notes

There are only two hard things in Computer Science; cache invalidation and naming things. - Phil Karlton

Naming API services when using React Query #

📁 Folder: /services/{path} (services can be whatever you want but services is vague enough).

GET is implied.

use{ Create | Delete | Update}{Noun(id) | Nouns}.ts

API Path Doing Hook Name
/users GET all users useUsers()
/users/{email} GET user by email useUser(email:string)
/users/{email} PUT update user useUpdateUser(user:User)

Home