This is an introductory post for a very broad feature – injecting custom server-side logic into Backendless. There are a lot of smaller features in Custom Business Logic, but it’s worth to start with a general overview. As you have seen in the previous posts, services includes in Backendless execute specific and well-defined operation based on the received arguments. For example, the logic API request checks if the user credentials are valid and if they are, establishes a session. An API call to search for an object in a data table, finds the object and returns it back to the client. There are many scenarios when the built-in functionality either should be augmented to perform some additional logic or completely overridden. This is exactly what Custom Business Logic (CBL) does – it is a framework that lets you inject your own code into the Backendless API invocation chain.
CBL relies on the concept of event handlers, where an event is an API invocation request. For example, the Login API request is the Login event. For every event, there are two possible handlers: a “before” and “after” handler. These handlers is where your custom code can be injected. The following diagram demonstrates the API invocation chain:
The CBL code can is deployed to the Backendless cloud and thus entirely managed by Backendless. Our service is responsible for making sure that the code is properly deployed and distributed to guarantee high availability and scalability. There are a lot of very cool features to simplify the process of building CBL and my future posts will be reviewing them in great detail. Until then to get you started, I recommend the Backendless Custom Business Logic Quick Start guide.