title: loopback - append filter before get request
body: <p>I am using Loopback for a node JS app. Loopback auto generates the CRUD api. So, I was trying to alter one get api so also include a table. I can do this by adding include filter in query as</p>
  
  <p><code>/api/expensecategories?filter[include]=vendors</code></p>
  
  <p>but I want <code>/api/expensecategories</code> to return with the table. For that I used <code>beforeRemote()</code> method to change the request before.</p>
  
  <p>My code for it is:</p>
  
  <pre><code>expensecategories.beforeRemote('find', function (ctx, inst, next) {
     console.log(ctx.req.url);
     ctx.req.url = "/?filter[include]=vendors";
     console.log(ctx.req.url);
     console.log('GET api called');
     next();
  });
  </code></pre>
  
  <p>this is changing the request url but not changing the response, it is the same and table is not included. I tried changing everything in <code>req</code> like </p>
  
  <p><code>ctx.req.query = {filter: { include: 'vendors' }};</code></p>
  
  <p>but no use. Any idea how can i achieve this. Both tables relation is already defined and I am able to get the desired result by making a custom api like,</p>
  
  <pre><code>expensecategories.expensecategory = function (cb) {
      expensecategories.find({
        include: {
          relation : 'vendors',
        }
      }, function(err, data) {
      cb(null, data);
      });
    };
  
    expensecategories.remoteMethod (
      'expensecategory', {
         description: 'get all expense types + vendors',
         http: {path: '/yes', verb: 'get'},
         returns: {arg: 'expensecategory', type: 'string'}
      }
    );
  </code></pre>
  
  <p>So, my table relation and everything is correct. I want the same result for <code>/expensecategories</code> also. Help!!!</p>