filter approaches on endpoints

Is there a preferred approach when it comes to adding filters to endpoints. There are two approaches I can think of. 1: Create a endpoint for each filter option, eg. "get-most-viewed", "get-most-recent", "get-highest-rated". 2: Have a singular endpoint that takes in an optional input and based on the value on the input queries for the data we want. Is one approach preferred over the other , if so why?
1 Reply
cje
cje2y ago
id base it on how messy the handler gets if you let it do multiple things vs how much duplicate code you have with separate ones but for example with prisma that would be not a lot of additional code
Want results from more Discord servers?
Add your server