Exploring APIs with Loopback 4

In October 2018, Loopback 4 was released for General Availability (GA). It ships as an open-source backend framework, written in TypeScript, for the creation of Node.js APIs. By developing with Loopback, your functionality is exposed as endpoints, which can be reused in future applications. For example, you might develop an endpoint that accepts as input an email address (or many) and a message, and sends that message to the respective recipient. That same endpoint can be used by other applications to send email notifications at specific points. Since the functionality is an endpoint, sending an email is as easy as making an HTTP request. This idea of creating reusable, independent, endpoints is one of the core concepts behind Loopback 4.

In the past, endpoints would be tested via third-party applications, like SoapUI or Postman. These applications make it easy to test endpoints, or “web services”, by allowing developers to create HTTP requests in a number of formats (XML, JSON, etc.). For most, this is still the preferred means of testing endpoints. Being centered around the concept of APIs, however, Loopback 4’s developers have integrated their own API Explorer, which comes standard in every new LB4 app. This explorer provides a listing of all endpoints exposed via the lB4 app. It also allows developers to test the endpoint from within a user-friendly interface, which provides an input form for each required parameter defined within the application, as well as a text box for more complex requests.

You might still need to rely on third-party apps for the testing of external APIs, but in terms of your own LB4 apps, you have everything you need at your disposal. By providing this API Explorer, LB4’s developers have made it easy for anyone to know the extensive list of available endpoints provided by your application. It’s a progressive move that helps to reduce the gap between development and testing, and poise LB4 as a viable, and promising, option for the development of future Node.js APIs.

In order to access your LB4 app’s API Explorer, while the app is running, navigate to 127.0.0.1:3000 (default URL). This is your application’s index page. Now, click on the “/explorer” link to enter the explorer. (Alternatively, navigate to 127.0.0.1:3000/explorer).

Image for post
Image for post

Now you’re in the API Explorer for your project. Here you can view a list of all endpoints exposed by your application, as well as perform test requests to each endpoint.

Image for post
Image for post

LB4, along with its API Explorer, should definitely be considered when thinking about creating an API-driven backend. With the world moving towards the development of API economies, this might just be the future of software development.

Interested in Computer Science, education and world domination.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store