Services Sidebar
The Services tool (the database icon in the builder's left toolbar) is where you create, edit and delete your interface's services. A service is a piece of shared state and logic, written as a Vue component, that every route and block in your interface can use. For how to write one, see Services.
Creating a service
- Click the Services tool.
- Click New Service.
- Enter a Title. The Key Name is filled in from the title. It's the name your code uses to reach the service, at
$sdk.app.services.<keyName>. - The code editor opens with a starter service that loads some articles when it starts. Replace it with your own code.
Managing services
- Click a service in the list to open its code. Use the back arrow at the top of the panel to return to the list, or the pencil button to edit its details.
- Each service's ⋮ button offers Edit Details (title and key name), Edit Code and Delete Service.
- Once you have more than four services, a Search Services box appears above the list.
Things to know
- If you change a service's key name, update every block and custom code that refers to the old name.
- Services are part of the interface's working draft. Save and publish to put changes live.
- A service's code must be a single object in braces,
{ ... }, holding Vue component options such asdata(),computed,methodsand lifecycle hooks. Plain object getters (get title() { ... }) don't work; see Services.