How should I return paginated records from mock json-server which is (json-server)?

Viewed 328

I want to return a page with JSON server which is (https://github.com/typicode/json-server) Currently, JSON Structure is looking like:

records :[
{
id: '2',
name: 'k',
},
{
id:'3',
name:'j'
}
]

I am able to return the records with pagination as GET /records?_page=1&_limit=10. After which I have changed the structure of JSON into:-

items:{
pageCount: 3,
records :[
{
id: '2',
name: 'k',
},
{
id:'3',
name:'j'
}
]
}

Now I want to do GET /records?_page=1&_limit=10 where I expect to return page 1 with 10 records and PageCount along with it.

0 Answers
Related