Skip to content

CodeRunner

Custom server code development, debugging and runtime execution in Backendless is made possible with a special utility/container called Backendless CodeRunner™which must be installed as an npm moduleThe CodeRunner SDK includes several command line tools enabling the process of debugging custom server-side code and subsequently deploying it to Backendless. It is important to note that CodeRunner makes it possible to debug custom code entirely on the developer's computer while the custom code is "plugged into" the API workflow in the cloud. This means any custom code whether it is an API service, API event handler or a timer, can be debugged using the traditional approaches (line-by-line code step through, variable inspection, console.log logging) by invoking that code through the centralized Backendless Cloud service. See the Development and Debugging section for details.

The process of developing custom business logic with Backendless is slightly different between API services and event handlers/timers. The only difference is the latter may include the step of code-generation which simplifies the workflow.

API Event Handlers and Timers


Backendless supports two approaches for developing custom business logic:

  1. Expressive, code-driven approach. With this approach a developer bypasses code generation and builds the custom code for event handlers and timers by using the published APIs.
  2. Declarative, console-driven approach. This approach relies on a code generator built into Backendless Console. Using the code generator developer selects the API events and configures schedules for timers for which he intends to add custom logic. The system automatically generates the code which can be downloaded for further development.

    The diagram below illustrates the process:
    backendless-development-process
    where:
  3. Developer generates code for event handlers and configures timer schedules using Backendless Console. The console includes a code generator which creates the place holder JS code for the API events and timers. The code can be downloaded as a project archive which includes project files for IntelliJ IDEAIDE. This step is optional, but it significantly simplifies the development process and saves development time.
  4. Using an IDE developer writes custom business logic. The compiled code is passed to CodeRunner™, which is a command line utility used for local debugging of the custom business logic code. Developer can optionally attach to the CodeRunner™ process to set breakpoints in the code for the line-level debugging.
  5. CodeRunner™ registers with the Backendless Cloud Service. It instructs Backendless to route the API and timer events to the developer computer for the debugged code.
  6. Client application sends an API request.  Backendless determines if there is an event handler registered for the received API request and routes the event information to CodeRunner™.
  7. CodeRunner™ receives the request and executes the code. Developer can inspect and debug invocations locally before the custom code is deployed to the production environment.

API Services


The workflow of developing API services is illustrated in the diagram below:
service-dev-process
where:

  1. Developer downloads and installs the Backendless CodeRunner SDK. Using an IDE developer writes the service code. The compiled code is passed to CodeRunner™, which is a command line utility used for local debugging. Developer can optionally attach to the CodeRunner™ process to set breakpoints in the code for step-by-step debugging.
  2. CodeRunner™ registers with the Backendless Cloud Service. It instructs Backendless to route the service invocation requests to the developer computer for the debugged code.
  3. Client application sends a service API request.  Backendless determines if there is a service registered for the received API request and routes it to CodeRunner™.
  4. CodeRunner™ receives the request and executes the code. Developer can inspect and debug invocations locally before the custom code is deployed to the production environment.