Code

Code provides developers the ability to implement a backend API necessary to make web, mobile and IoT apps all perform and integrate in the desired way. The ClearBlade Platform makes it easy to author JavaScript that will be securely protected and execute in a highly scalable manner. This JavaScript follows the best practices associated with the “micro-service” architectures of today.

ClearBlade Overview

Within the Code section of a System you can device two types of Code that ultimately make up the application layer of your System

  • Services are available externally and called by clients via HTTP or MQTT
  • Libraries are lines of javascript that can be included into services to provide reusable logic

Services

A service in the ClearBlade Platform represents the creation of a custom API endpoint. This service can be called by clients when specific business function needs to be executed. In addition to implementing business logic services are capable of

  • Accessing and modifying data
  • Sending messages
  • Integration with
    • legacy enterprise systems
    • cloud-based applications
    • the local server IO

Services take parameters that are simple string or complex JSON structures. Responses from Services can be as complex as the developer desires. Each Service is secured via the System authority model that allows only defined roles execution priviledges

Libraries

Libraries allow for creating reusable logic within a System. Libraries contain JavaScript with all the same functional capabilities of Services, but are not directly exposed to the clients. A Service that requires a Library will have the library code injected into the Service at the beginning of the service execution. Libraries are valuable for creating global style variables, helper functions, or just improving the readability of a service. There are two types of libraries:

Native Libraries

Native Libraries are not editable by developers and are available in all Systems. They contain code, written by ClearBlade, that performs low-level, high-performance interactions. These libraries include “clearblade”, “crypto”, “file_writer”, “geo”, “http”, “jsutil”, “log”, “mailer”, “net_cb”, and “oauth2_lib”.

Custom Libraries

Developers may create their own reusable libraries that execute within the scope of a single System. These libraries contain javascript that will be injected into the beginning of each service that requires them.