Ember-data adapter that uses query string params


#1

Brand new to ember, so I apologize if this is overly newb. I’m trying to get some data to my store from a JSON API that takes query string parameters (it’s a search engine).

so for example to run a search for “shirt” with price > $100 and I want to see 18 per set (page) the url would be:

http://localhost:8000/search?q=shirt&paging=18&filter-price=100

(that’s obviously my dev url)

I understand how to set up the model, it’s the adapter and route I’m having trouble with. I assume this is the starting point (for the adapter):

import DS from 'ember-data';

export default DS.JSONAPIAdapter.extend({
	host: 'http://localhost:8000',
	pathForType() {
		return 'search';
	}
});

but given the API isn’t accepting routes like /path/to/id, how can I tell it to specify query string keys and values?


#2

Kind of figured it out, with the help of this article:

https://emberigniter.com/pagination-in-ember-with-json-api-backend/