Reduce number of SQL queries with falcor-router references
<p>Suppose I have two falcor-routes</p>

<pre><code>route: 'users[{ranges}]'
</code></pre>

<p>and</p>

<pre><code>route: 'UserById[{integers:ids}]["name","email"]'
</code></pre>

<p>whereas <code>users</code> returns references to the <code>UserById</code>-route. If I then fire a query</p>

<pre><code>get('users[0..10]["name","email"]')
</code></pre>

<p>against this, the router will first evaluate the <code>users[0..10]</code> part which will perform a <code>SELECT id FROM users LIMIT 10</code> on the database and return the corresponding ids. The router will then use these ids together with the specific route to fill the actual values. Without akward caching on the UserService-implementation (which would need to be repeated for any similar case, e.g. addresses, cost-types and the like) this would produce at least two queries against my persistence backend, wheere a more traditional approach using a single RESTful endpoint</p>

<pre><code>GET /users/?offset=0&amp;limit=10
</code></pre>

<p>would most probably be content with a single one.</p>

<p>Is there a general <em>best practices</em> approach how to optimize database queries in this scenario, e.g. by some clever cache between the router and the backend services? Returning the full information already in the <code>users</code> route of the model is a no-go since our users might have graph links to friends which are users themselves.</p>