This is a migrated thread and some comments may be shown as answers.

Getting started with Cloud Code

2 Answers 79 Views
JavaScript SDK
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alon
Top achievements
Rank 1
Alon asked on 21 May 2014, 03:44 PM
Hi,

I am currently evaluating this platform and wanted to create a cloud code service. Here is what I am trying to achieve:

1. Create a REST API URL which can be called by a native app
2. When the REST API is invoked, it will execute some server side JS which will read a server database table and return the data.

Seems pretty straight forward but I am embarressed to say that I can not see anywhere in the dev environment where I can create this cloud code. I can see where I can add HTML, JS files etc but I am trying to create a server side 'service'.

Any ideas what I am missing? Perhaps there is a tutorial on getting started with cloud code?

Alon

2 Answers, 1 is accepted

Sort by
0
Alon
Top achievements
Rank 1
answered on 21 May 2014, 03:58 PM
OK I just saw it. WHen you got into the 'types' view there is a button on the right hand side which is clearly marked as 'Cloud Code'. This lets you write custom JS which is executed when a recorded is update/deleted/inserted, etc. 

However, I still dont see how I can call this from a REST API. Do I really need a separate data connector server to do this?
0
Anton Dobrev
Telerik team
answered on 21 May 2014, 04:49 PM
Hi Alon,

You can use the Cloud Code to implement your own custom logic which will be triggered before and after the CRUD operations over the corresponding content type in a backend project. You can use the utility methods, the JavaScript SDK of Telerik Backend Services or plain JavaScript. Furthermore, you can make use of the integrated Cloud Code debugging.

You can access the Backend Services data store via the REST API, or any of the client-side SDKs. What you need is the API key for this project, located in the API keys section in the left navigation pane of the portal.

The Data Connectors feature allows you to create a content type from a table in a existing SQL database and it will be treated as a Backend Services content type. The Cloud Code will be triggered as well when the client app makes a request to this content type through the Backend Services API.

We are eagerly looking to introducing custom Cloud Code functions and tasks as stated in our roadmap.

One thing that you need to know is that the cloud code execution time is limited to 5 seconds per event. Too many timeouts for a limited amount of time will lead to disabling the cloud code layer for this content type.
 
Please, let us know if you have questions.

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
Tags
JavaScript SDK
Asked by
Alon
Top achievements
Rank 1
Answers by
Alon
Top achievements
Rank 1
Anton Dobrev
Telerik team
Share this question
or