Many who are familiar with LoopBack first discovered it as a way to build RESTful APIs, but LoopBack offers more than just the tools API developers need to build the API itself. LoopBack also also provides optional features that are focused on enriching your API offering, like push notifications and user management. Since a strong use case of APIs is providing user-based access control, let’s start there.
Since July 2014, when we released LoopBack version 2.0, we have added over 90 new features while keeping full backwards compatibility. To achieve that, we had to make some compromises and elect suboptimal solutions over those that would introduce breaking changes. Additionally, as an increasing number of LoopBack users put the framework into a wider variety of uses, we have learned that some parts of LoopBack need a redesign to support new needs in an easy-to-use manner.
As a result, we feel that the time has come to apply what we learned by tidying up the code and public APIs, even at the expense of breaking backwards compatibility. Read more
I knew LoopBack supported pagination, but not exactly how it did. So, I wanted to build a quick demo for my own learning and I thought it might be useful to share it with others. This will be a relatively simple blog post to demonstrate what I learned.
Pagination is simply the process of presenting a large set of data to the user one “page”, or one set, at a time. For example, if you have a few hundred records, it is a lot less intimidating to the user to show them just ten or so records first. For this demo, I created a simple model, Person. Person has two properties: name and picture. To create a large amount of data (so we can actually paginate), I used the excellent Random User Generator API to spit out about two thousand users. I did this one time of course, saved the result as a huge JSON file, and then created a quick script to import this into my LoopBack application. The net result was 5000 unique names and pictures in my datastore. Now for the fun part.
Compose APIs, Build, Deploy and Monitor Node
Install API Connect
$ npm install -g apiconnect
Create your API Connect project
$ apic loopback
Launch API Designer
$ cd your-project
$ apic edit
API Designer will run on your local browser
An IBM BlueMix account is required to use the Designer. Register for IBM Bluemix