Getting started with Cloud Code

3 posts, 0 answers
  1. Alon
    Alon avatar
    3 posts
    Member since:
    May 2014

    Posted 21 May 2014 Link to this post


    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?

  2. Alon
    Alon avatar
    3 posts
    Member since:
    May 2014

    Posted 21 May 2014 Link to this post

    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?
  3. Anton Dobrev
    Anton Dobrev avatar
    607 posts

    Posted 21 May 2014 Link to this post

    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.

    Anton Dobrev
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
Back to Top