-
-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to paginate the results? i.e. ?page=1 or ?limit=10 #65
Comments
Yes, a list of all the routes you can use is here: https://github.com/typicode/json-server |
Yes, this is easy . use this like http://jsonplaceholder.typicode.com/photos?_start=0&_limit=5 |
I've documented pagination in PR #105 which should make it easier to spot this feature. |
Here's an example of the pagination made with JSON placeholder and Nuxtjs. |
This doesn't seem to work as far as I can tell, I keep getting "Application Error" whenever I pass any query parameters. |
@skipjack please go to a site that does not have Content Security Policy (CSP) directive fetch('https://jsonplaceholder.typicode.com/posts?_page=1&_limit=2')
.then(async response => {
const link = response.headers.get('link') // link to next page (REST)
const json = await response.json() // data payload
console.log(link, json)
}) What do you get back? If you get an array with 2 objects, then it works. In the Speed Dial page in Opera (ctrl+t), I get the following output:
https://github.com/ has CSP |
GET /posts?_page=7 instruction : https://github.com/typicode/json-server/blob/master/README.md#paginate |
would be nice to include the total number of pages in the response or am I missing something? |
I also needed the same thing, and it's there, it's inside response headers under key
|
Is there a way to paginate the results? i.e. ?page=1 or ?limit=10
The text was updated successfully, but these errors were encountered: