Create REST APIs using LoopBack  

Use LoopBack to build and expose REST APIs in 5 minutes

Last updated | By David Okun, Andy Shi

Description

Creating REST APIs has always been a challenging job. LoopBack, a highly extensible open source Node.js API framework, is meant to make that experience easy. IBM API Connect provides the tools to use with LoopBack projects. In this developer pattern, we’ll demonstrate the basic flows to create and expose REST APIs using LoopBack.

Overview

Assuming you want to create REST APIs for your web service, which tool first comes to mind? The answer may vary, but I can assure you that none will be as straightforward as LoopBack, especially if you are using JavaScript and Node.js. If you haven’t tried it out, now’s a good time to get started! In this journey, we’ll build REST APIs for a service named AnimalsDemo. The service itself is fictional, but the steps are the same that you’d use for any real service. First, we create the APIs, which we then link to a data source. Second, we define the data models and set up access control. Finally, we push the app to IBM Cloud. These steps will remain the same even with an actual production-ready service. The beauty of LoopBack is it saves a lot of effort in coding redundant functionalities, since most REST APIs are about CRUD operations after all.

Flow

  1. User scaffolds API using LoopBack CLI.
  2. User links to Compose for MongoDB data source.
  3. User generates the model objects.
  4. User configures the ACL.
  5. User prepares the manifests for deployment.
  6. User pushes app to Bluemix® Cloud Foundry.

Related Blogs

Newsletters: The Curious Developer’s Best Friend

The great thing about software development is that there is always something new to learn! The terrible thing about software development is that there is always something new to learn! Luckily, there are tons of wonderful people sharing their knowledge every week in helpful and entertaining newsletters … and unfortunately, it can be really easy...

Continue reading Newsletters: The Curious Developer’s Best Friend

Kubernetes Upstream Contribution – 5 Do’s and Don’t

There is a good amount of documentation material out there on the Kubernetes community website which every contributor should read. However, if you are a new or intermediate contributor, or thinking to start contributing to Kubernetes upstream, hopefully, this post will help you understand some of the lessons that I have learned. This post discusses...

Continue reading Kubernetes Upstream Contribution – 5 Do’s and Don’t

Get a taste of the LoopBack framework

Anyone who creates REST APIs knows how challenging it can be. But LoopBack, an extensible open source Node.js API framework, aims to simplify that experience. Before we go any deeper, it is important to understand the following: Node.js is a server just like Apache Tomcat. It is not a framework. Express.js is a JavaScript framework...

Continue reading Get a taste of the LoopBack framework

Related Links

LoopBack

Learn more about this highly extensible open source Node.js framework.

Create REST APIs in 5 minutes

Applications these days need APIs. And let’s face it – it’s not always easy to set them up. LoopBack is a Node API framework built to solve this problem. Using LoopBack, you can quickly generate powerful REST APIs in 5 minutes, flat.

Deploy a REST API to Bluemix in 5 Minutes

LoopBack is a Node API framework for creating robust and fully functional REST APIs from a variety of data sources. In this tutorial, I show how you can create an API using LoopBack and an existing MongoDB data store in just 5 minutes — with user authentication and many other great features included out of the box.