javascript-boilerplate icon indicating copy to clipboard operation
javascript-boilerplate copied to clipboard

Resource querying/filtering not intuitive or not working

Open lucidsif opened this issue 8 years ago • 0 comments

I'm able to limit how many resources are returned by using the following query: 'http://localhost:3000/api/products?limit=2'. This was simple to do, but I've been unable to use any of the other query parameters.

For example, given how RESTful query filtering is usually designed, I tried filtering with 'http://localhost:3000/api/products?id=2' (and a few other variations), but this did not affect the resources queried. Does resource filtering require the keyword 'filter' in the query string? I also tried using sort. I created a table of vehicles(id, year, make, models) and implemented the api routes for vehicles. I'm able to perform CRUD actions successfully with vehicles, but none of the query parameters are successful except for 'limit'. I tried sorting with 'http://localhost:3000/api/vehicles?sort=year', but the resources were not sorted.

I've tried reading the code inside src/api/lib/middlewarespgCrud.js and co-postgres-queries/lib/queries/selectPage.js and co-postgres-queries/lib/queries/whereQuery.js. The code in the co-postgres-queries library is pretty dense. I don't know what the problem is.

lucidsif avatar Dec 14 '16 20:12 lucidsif