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:
- Define services in CDS → see Cookbook > Providing & Consuming Services
- Add service implementations →
cds.Service
> Implementations - Register custom event handlers in which →
srv.on
/before
/after
- Read/write data from other services in which →
srv.run
+cds.ql
- …, i.e. from your primary database →
cds.DatabaseService
- …, i.e. from other connected services →
cds.RemoteService
- 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