How to create custom REST API endpoint correctly : <p>Suppose we have customers: /api/customers (/api/customers/{id})</p>

<p>With the following content:</p>

<pre><code>[{
    name: "Mike",
    age: 20,
    amount: 300
},
{
    name: "John",
    age: 30,
    amount: 600
}]
</code></pre>

<p>But there are different tasks when you have to perform various data manipulations.</p>

<p>Suppose we need to display the client who spent the most (in the "amount" field).</p>

<p>What the endpoint should look like for this request?</p>

<p>I have a few suggestions how to do this, please correct me:</p>

<pre><code>1. /api/customers/spent-more

2. /api/customers-spent-more

3. /api/customers?action=spent-more
</code></pre>

<p>How do you perform similar tasks, share experiences</p>
