Skip to content

Service Design

The service developed in this guide is a trivialized shopping cart. The APIs generated by Backendless from the code allows adding items to a shopping cart, retrieving and deleting the contents of the cart. Each operation of the service must be stateless, as a result, any intermediary state between the service calls must be stored elsewhere (i.e. Backendless persistent storage, server-side cache, etc). In the design of the code, the state is a JavaScript object representing a shopping cart. The object is stored in Backendless Cache between the service invocations. Every method call retrieves the cart object from cache, updates it as necessary and then places it back into cache. The code identifies every shopping cart by a logical name, thus the same service code will be able to handle multiple cart objects. The "purchase" API call persists the contents of the shopping cart in the Backendless database. The diagram below illustrates the design:

API-Service-Design