{"action":"created","issue":{"url":"https://api.github.com/repos/feathersjs/feathers/issues/135","labels_url":"https://api.github.com/repos/feathersjs/feathers/issues/135/labels{/name}","comments_url":"https://api.github.com/repos/feathersjs/feathers/issues/135/comments","events_url":"https://api.github.com/repos/feathersjs/feathers/issues/135/events","html_url":"https://github.com/feathersjs/feathers/issues/135","id":76494914,"number":135,"title":"Better support for pagination","user":{"login":"daffl","id":338316,"avatar_url":"https://avatars.githubusercontent.com/u/338316?v=3","gravatar_id":"","url":"https://api.github.com/users/daffl","html_url":"https://github.com/daffl","followers_url":"https://api.github.com/users/daffl/followers","following_url":"https://api.github.com/users/daffl/following{/other_user}","gists_url":"https://api.github.com/users/daffl/gists{/gist_id}","starred_url":"https://api.github.com/users/daffl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daffl/subscriptions","organizations_url":"https://api.github.com/users/daffl/orgs","repos_url":"https://api.github.com/users/daffl/repos","events_url":"https://api.github.com/users/daffl/events{/privacy}","received_events_url":"https://api.github.com/users/daffl/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/feathersjs/feathers/labels/feature","name":"feature","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/feathersjs/feathers/milestones/6","html_url":"https://github.com/feathersjs/feathers/milestones/2.0.0","labels_url":"https://api.github.com/repos/feathersjs/feathers/milestones/6/labels","id":1015565,"number":6,"title":"2.0.0","description":"Next major Feathers release which will be split up into several submodules and fully use ES6. This will be a breaking change.\r\n\r\nIn addition we should have:\r\n\r\n- authentication with JWT sorted out\r\n- better documentation\r\n- a more comprehensive example\r\n- micro-service scaling using `feathers-sync`\r\n- app and service generators","creator":{"login":"daffl","id":338316,"avatar_url":"https://avatars.githubusercontent.com/u/338316?v=3","gravatar_id":"","url":"https://api.github.com/users/daffl","html_url":"https://github.com/daffl","followers_url":"https://api.github.com/users/daffl/followers","following_url":"https://api.github.com/users/daffl/following{/other_user}","gists_url":"https://api.github.com/users/daffl/gists{/gist_id}","starred_url":"https://api.github.com/users/daffl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daffl/subscriptions","organizations_url":"https://api.github.com/users/daffl/orgs","repos_url":"https://api.github.com/users/daffl/repos","events_url":"https://api.github.com/users/daffl/events{/privacy}","received_events_url":"https://api.github.com/users/daffl/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":3,"state":"open","created_at":"2015-03-10T21:56:21Z","updated_at":"2015-12-26T21:12:24Z","due_on":"2016-01-01T07:00:00Z","closed_at":null},"comments":4,"created_at":"2015-05-14T21:23:49Z","updated_at":"2015-12-28T22:19:51Z","closed_at":null,"body":"I'd like to add better support for pagination and something similar to GitHubs `Link:` HTTP headers (see [here](https://developer.github.com/guides/traversing-with-pagination/)) like:\r\n\r\n```\r\nLink: <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=15>; rel=\"next\",\r\n  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34>; rel=\"last\",\r\n  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=1>; rel=\"first\",\r\n  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=13>; rel=\"prev\"\r\n```\r\n\r\nThis actually shouldn't be too hard to implement and backwards compatible. All we need to do is have `service.find` return an object with information about it's pagination data (you should use an object with `{ \"data\": [] }` anyway for security reasons):\r\n\r\n```js\r\n/// /todos\r\n{\r\n  \"total\": 1000,\r\n  \"limit\": 20,\r\n  \"start\": 0,\r\n  \"data\": []\r\n}\r\n```\r\n\r\nOur quasi standard is to use `$` for query parameters like `$limit=10&$start=20`. Then we would know how to generate a link header like:\r\n\r\n```\r\nLink: <http://feathersjs.com/todos?$limit=20&$start=19>; rel=\"next\",\r\n  <http://feathersjs.com/todos?$limit=20&$start=979>; rel=\"last\"\r\n```\r\n\r\nIf we make the pre-built services support this out of the box it will be really nice to use (I had to code this manually a couple of times already)."},"comment":{"url":"https://api.github.com/repos/feathersjs/feathers/issues/comments/167668686","html_url":"https://github.com/feathersjs/feathers/issues/135#issuecomment-167668686","issue_url":"https://api.github.com/repos/feathersjs/feathers/issues/135","id":167668686,"user":{"login":"ekryski","id":599019,"avatar_url":"https://avatars.githubusercontent.com/u/599019?v=3","gravatar_id":"","url":"https://api.github.com/users/ekryski","html_url":"https://github.com/ekryski","followers_url":"https://api.github.com/users/ekryski/followers","following_url":"https://api.github.com/users/ekryski/following{/other_user}","gists_url":"https://api.github.com/users/ekryski/gists{/gist_id}","starred_url":"https://api.github.com/users/ekryski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekryski/subscriptions","organizations_url":"https://api.github.com/users/ekryski/orgs","repos_url":"https://api.github.com/users/ekryski/repos","events_url":"https://api.github.com/users/ekryski/events{/privacy}","received_events_url":"https://api.github.com/users/ekryski/received_events","type":"User","site_admin":false},"created_at":"2015-12-28T22:19:51Z","updated_at":"2015-12-28T22:19:51Z","body":"@daffl do we want to also implement the Link Header spec or just leave the meta data in the response.\r\n\r\nI can't help but feel we should be returning:\r\n\r\n- the page that you are currently on,\r\n- a link to the previous page\r\n- a link to the next page\r\n\r\nI like that we are bringing back more data than Django REST but I sort of like how [their response](http://www.django-rest-framework.org/api-guide/pagination/) is looking.\r\n\r\nI realize that you can calculate the page based on the `$limit` and `$skip` but it sure would be nice to have a response like so:\r\n\r\n```json\r\n/// /todos\r\n{\r\n  \"total\": 1000,\r\n  \"limit\": 20,\r\n  \"skip\": 40,\r\n  \"page\": 3,\r\n  \"next\": \"https://api.feathersjs.com/todos/?$page=4\",\r\n  \"previous\": \"https://api.feathersjs.com/todos/?$page=2\",\r\n  \"data\": []\r\n}\r\n```\r\n\r\nThoughts?"}}