Now available! Red Hat OpenShift Container Platform for Linux on IBM Z and LinuxONE Learn more

Cache IoT device data to create quick Carbon-based front ends

Summary

This code pattern is for developers looking to build quick and efficient front ends with a live view of their IoT device data using an API caching server with IBM Carbon Design System. Learn how to build an API caching Node.js server that uses Loopback.io connected with IBM Cloudant database.

Description

This developer code pattern demonstrates an API caching server that can reside between your Carbon Design System front end and external APIs, and can help with building quick and efficient interfaces. The pattern showcases a Node.js server built with Loopback that the application front end communicates with, and which interacts with an IBM Cloudant® database that holds the information about the external APIs your application must communicate with to load its UI components.

After you’ve completed this code pattern, you’ll understand how to:

  • Create a Node.js and Loopback.io back-end server
  • Create APIs with Loopback.io
  • Set up IBM Cloudant and interface with Loopback.io
  • Run IBM Cloudant locally

Flow

Architecture diagram for this pattern

  1. The user authenticates to the API server through the front end created with the Carbon Design System.
  2. The front end makes a request for the data to be visualized from a REST API.
  3. The API server makes a request to the external API with the stored credentials for that API.
  4. (4a) If there is a good response, the API server receives the new data and caches it, then sends it to the front end. (4b) If there is a bad response, the API server retrieves the previously cached API and returns that API to the front end.
  5. On a given interval, the API server refreshes the data it has stored for the collections of APIs on which it has information.

Instructions

Ready to get started? Find detailed technical steps for this code pattern in the README in the GitHub repository.

Tony Melo
Ashutosh Nath Agarwal