If you find any errors, typos or have general feedback, select the text and click CTRL+ALT+ENTER.

Introduction

A Generic service is used to extend the standard REST service. It still has inputs and outputs (as a standard service), and can be mapped, but the actual service implementation, or what it does, is entirely up to you. For example, the service can access local browser databases such as IndexedDB or SQLite, or do calculations.

Creating a Generic service

A Generic service can be created via CREATE NEW > Service > Generic (custom JavaScript implementation).

Default or custom implementation can be opened by clicking Open:

Use a Generic service to provide custom access to data. You can add some custom logic to the automatically generated JavaScript file. If you create a new JavaScript file, there’s default implementation code that can be edited to make your app more flexible and customized.

To call the added service, go to SCOPE and use the snippet Invoke service in the function editor by selecting it from the drop-down:

Сlick Backspace and then CTRL+SPACE to autocomplete a service name. Once the service has been added to the function code, click Mapping to map the service to the page.

Each snippet in the drop-down list has a pop-up with its description and code preview (with syntax highlight) and a link to documentation (if available).

More on how to add services to the page can be found here.

Custom Implementation

Clicking Reset invokes the Add custom implementation option:
Reset

Custom implementation can be added by clicking Add custom implementation.

As with the standard REST service, the Generic service also has Request and Response tabs:RequestTab
They set the general structure of the query. Though they can be rewritten with any other structure inside implementation code, it’s highly recommended that you follow the structure you’ve specified.

The file of custom JavaScript implementation contains the source code of the generic service. You may change its content following the comments throughout the code.