For anyone developing business logic in JS, we have put together some suggestions for troubleshooting your deployment. The page is added to the product documentation. One of the new features described in the doc is the ability to redirect console.log messages to Backendless logging. Once your JS code is deployed to production, messages from the console.log calls will be routed to the log file wit the SERVER_CODE logging category.
We resume our webinar series with the plan to conduct two webinars a month. The first one is dedicated to the Backendless 2.0 release where you get an overview of the Platform and the new features of the release. Our webinars are interactive and you can ask us any questions.
Join the upcoming free webinar “New Backendless 2.0 Release – Overview and Highlights” and get a detailed look at the new powerful development functionality: geofencing, server-side logging API, node.JS support and API Engine – a powerful API management solution.
The webinar will be useful for mobile app developers of all ranks – from a beginner to a experienced professional – as there will be plenty of tips & tricks to enhance your productivity in mobile application development.
When: Tuesday, June 30, 2015
Time: 12:00pm (CDT) *to convert the start time for the necessary timezone, use World Time Converter
Duration: 1 hour (with Q&A)
Speaker: Mark Piller – CEO/ Founder of Backendless
NOTE: We are using gotowebinar system to conduct an interactive webinar. This service has a strong desktop / Android mobile service for registration Please use your any desktop or Android mobile devices to register for our event.
If you have any questions feel free to leave your comments or email below this post or contact email@example.com with any issues you need to be clarified.
The custom business logic feature in Backendless lets you add your own server-side code to handle client API requests. In this post I am going to review how to add the Data Service API handlers.
With that type of handler you can intercept and add additional logic for the APIs which store data in Backendless, run queries, update or delete data objects.
The easiest way to start building server-side Backendless code is the developer console. Login to your account, select an app and click the Business Logic icon. I assume there are some data tables in your backend, if not, make sure to create a few. Since we are going to add an event handler which works with persistent data, click Data Tables from the list of available handler categories. Click Add Event Handler, the screen should look as shown below:
Previously I wrote how to generate custom business logic code for API event handlers and how to locally debug your custom code. Now your code is ready to be pushed to the Backendless servers. Once it is out there, the Backendless infrastructure automatically handles scaling the code execution and routing requests to an instance available to run your code. The process for deploying an API event handler is very similar to the one for timers (see deploying custom business logic in timers to Backendless).
The ZIP file you downloaded from the Backendless Console (when it generated the code for an event handler) includes the deploying utility located in the /bin directory. To deploy the code, open a command prompt window and run the Deploy script. There are two of them, one for Linux (Deploy.sh) and the other for Windows (Deploy.bat). When you run the utility, it inspects all the custom code, packages and deploys it to the Backendless servers. The utility output would look similar to the one below:
Previously I described how to use the Backendless Console to generate custom business logic code. In this post I will describe one of the most amazing features in Backendless – an ability to debug custom server-side code on the developer computer before deploying it to the cloud. It would be very helpful for you to go through the previous feature to establish the surrounding context.
Once the code is generated, you can use the Download button to get a project archive (zip) with all the source code. In addition to the code the archive also contains a special command line utility which you can use to run the custom code locally. The trick of the local execution is the code inject itself into the API processing chain. This happens despite the fact that the API invocation is handled in the cloud, but the custom code runs on your computer. To put things in perspective, see the diagram below:
In my previous post I introduced the feature of server-side API event handlers – a mechanism for injecting custom business logic into Backendless. In this post I am going to review the process of creating an event handler for User Service APIs using Backendless console. The User Service APIs include: user registration, login, logout, user update, password recovery and retrieval of user schema (a list of user properties and their types). You can build an event handler (or two event handlers – “before” and “after”) for each of these operations.
There are two types of custom (server-side) business logic supported by Backendless – timers and event handlers. In my previous posts have reviewed the entire process of developing, testing and deploying timers. Now I’m going to focus on event handlers. An event handler is a piece of custom server-side logic which can be plugged into the API processing chain. The diagram below illustrates how API processing works – the gray box is the server-side of Backendless. As you can see, there are two blocks where custom business logic can be placed – the “before” and “after” handlers:
Now that you know how to generate code for custom business logic timers (Backendless background jobs) and how to locally debug custom business logic, it is time to learn how to deploy that code to production. By “production” I mean the Backendless Online service running in the cloud. It may not be your ultimate production phase – you may still be developing the application, but it is a convenient way to distinguish it from the debugging/development step.
In order to push your custom server-side code with Timers to Backendless, the CodeRunner distribution and the zip file downloaded from the Business Logic code generator, include a command line utility. The utility name is “Deploy” and it has an appropriate extension for the supported operating systems (.sh for Linux and .bat for Windows).
In my previous post I introduced Backendless CodeRunner – a debugging utility for custom business logic. Now that you can run your timer code locally using CodeRunner, I’d like to show how you can attach your IDE to the CodeRunner process and debug the code.
The CodeRunner is configured to listen for remote debugging connections on port 5005. It is sufficient to create a debugging configuration in your IDE. For example, in IntelliJ IDEA, the configuration would look like this: