Search

CAP Service SDK for Node.js

Reference Documentation

Introduction

As an application developer you’d primarily use the Node.js APIs documented herein to implement domain-specific custom logic along these lines:

  1. Define services in CDS → see Cookbook > Providing & Consuming Services
  2. Add service implementations → cds.Service > Implementations
  3. Register custom event handlers in which → srv.on/before/after
  4. Read/write data from other services in which → srv.run + cds.ql
  5. …, i.e. from your primary database → cds.DatabaseService
  6. …, i.e. from other connected services → cds.RemoteService
  7. Emit and handle asynchronous events → cds.MessagingService

All the rest is largely handled by the CAP runtime framework behind the scenes. This especially applies to bootstrapping the cds.server and the generic features provided through cds.ApplicationService.

Content

Conventions

We use the following notations in method signatures:

cds.connect.to (service, options?) service
cds.serve (service) … service
.from (model)
.at (path)

Read them as follows:

  • param? — appended question marks denote optional parameters
  • result — solid line arrows: returns the given result
  • result — dashed arrows: returns a [Promise] resolving to the given result
  • ... — denotes a fluent API, eventually returning/resolving to given result
  • — denotes subsequent methods to add options in a fluent API
Show/Hide Beta Features