Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
andy shi edited this page Oct 10, 2017 · 17 revisions

Short Name

Create REST APIs Using LoopBack

Short Description

Build and Expose REST API with LoopBack in 5 minutes

Offering Type

Cloud

Introduction

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 newest tools to use with LoopBack projects. In this journey, we’ll demonstrate the basic flows to create and expose REST apis using LoopBack.

Author

Andy Shi

David Okun

Code:

https://github.com/IBM/loopback-in-five/

Demo

Video

video part one

video part two

Overview

Assuming you want to create REST APs 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, as after all most REST APIs are about CRUD operations.

Flow

architecture-diagram

  1. User scaffolds api using lb cli
  2. User links to compose 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

Included components

Compose for Mongodb : cloud based Mongodb service. (this one is not on the list) LoopBack: A highly extensible, open source Node.js framework. Cloud Foundry : Build, deploy, and run applications on an open source cloud platform.

Technologies

API Management: The process of creating, documenting, and making APIs available, providing access controls, and tracking statistics. Node.js: An open-source JavaScript run-time environment for executing server-side JavaScript code. Databases: Repository for storing and managing collections of data.

Platform as a Service: A platform for Cloud services making it easy to develop, deploy, and manage applications by abstracting the complexity of maintaining the infrastructure required to carry out these activities.

Blogs

Part 1

Part 2

References

LoopBack
Node.js
StrongLoop