Most APIs will eventually run up against the problem of paginating data. Sending entire data sets in one request is simply too expensive for both client and server. I am going to show you an easy way to paginate your data in hapi, in a way that is easy to use in your client code.
To add pagination to your API, the first step is to install the hapi-pagination module. It will automatically add
limit parameters to the routes you want paginated, and is very customizable to suit your particular needs.
Here's the config I ended ...