From the course: Building APIs with LoopBack
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Paging support - Node.js Tutorial
From the course: Building APIs with LoopBack
Paging support
- [Instructor] The next way you can filter data with LoopBack is by paging. Paging as a concept is basically the idea of returning one set of data. If we have 100 cats, for example, we may want to return 10 at a time, not all 100. In LoopBack, this is done using a few things. The first is limit. This simply restricts the total number of results. You can use this without paging if you simply want to ensure you don't ever return too many results. Skip is how you do paging in terms of getting page two, three, and so forth. It simply means, start returning results after skipping the first so many. Finally, to do paging, you need to know how many values you have in total. LoopBack provides a simple way of doing that. To limit, it's a pretty simple syntax and follows the format that we've been using before. By adding this query string value to the URL, we can tell it to only return X many results. Let's try this. In this example, I've done filter limit equals five, and you can see that I…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.