Introduction to Cloud Code

The Cloud Code layer of Telerik Platform enables you to implement custom server-side logic using JavaScript. The logic can be used for validating and modifying requests and responses, sending push notifications, messages or emails, maintaining the stored data, making calls to an external service and others.

You have the option to write the code directly in the Telerik Platform portal or upload JavaScript files with the relevant code. Working with Cloud Code is also available in Progress Telerik Platform AppBuilder.

To facilitate you, Cloud Code integrates a copy of the Backend Services JavaScript SDK that you can use. Another set of operations that are specific to Cloud Code are available through the Cloud Code SDK. In addition, Cloud Code allows you to use a number of popular utility [JavaScript libraries][/server-side-logic/cloud-code/cloud-code-external-libraries] out of the box.

Telerik Platform supports two types of Cloud Code: Cloud Code for Data and Cloud Functions.

Cloud Code for Data

Cloud Code for Data is similar to a trigger in a conventional database. This type of code gets executed whenever an item is created, read, updated, or deleted. Furthermore, you can plug your code both before the query execution or after, to act on the query result. This way you can change both the query or the result based on your custom logic.

Cloud Code for Data can be useful in these example scenarios among others:

  • Validating data before inserting or updating items
  • Updating related data on inserting or updating items
  • Sending emails or push notifications after inserting or deleting items
  • Enhancing data before returning it to the client (adding custom fields to items, fetching related data, etc.)

Read more in Cloud Code for Data.

Cloud Functions

With Cloud Functions, you can write a piece of code, store it in the cloud, and execute it whenever you need on the Telerik Platform servers. Cloud functions can accept parameters and can return a result.

Each Cloud Function is assigned a unique RESTful endpoint. To invoke the Cloud Function, you make an HTTP request to the endpoint's URL. Parameters to the function are supplied as query parameters in the URL or as HTTP headers. You can also use the body of the request to send any data you want. The result of the function is obtained through the HTTP response.

Cloud Functions can be useful in these example scenarios among others:

  • Server-side logic that is not triggered by a data operation
  • Hook for integration with external products and services
  • Generating reports

You can read more in Cloud Functions.

In this section:

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.