API Patching Strategy

For patches on objects that update single fields, is it better to push each patch to its own route or have one route for all patches? Say you have a simple object
color
shape
angle
color
shape
angle
if I wanted to just change the color field, should that be its own route or catch all field updates into one route that handles patching any of the object fields?
3 Replies
Wiznet
WiznetOP5mo ago
It almost feels nicer to make one route = one field so if the underlying object shape changes, you only need to update its related patche routes
Ovidius
Ovidius5mo ago
In a case like this I would update the whole object everytime. I break when they are too many and there is some logical grouping. It's nice to have it separated but It seems much more code for too small performance gain.
Aamih
Aamih5mo ago
⨯ UPLOADTHING 10:51:48 am No secret provided POST /api/uploadthing?actionType=upload&slug=imageUploader 500 in 83ms why am i seeing this error? can i not access .env.local file
Want results from more Discord servers?
Add your server