0

How to implement a custom handler for a CAP CDS Se...

 1 month ago
source link: https://community.sap.com/t5/technology-q-a/how-to-implement-a-custom-handler-for-a-cap-cds-service-with-a-namespace/qaq-p/13677074
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How to implement a custom handler for a CAP CDS Service with a namespace ?

DSree

Explorer

an hour ago

Hello,

I am implementing a CAP CDS Service in NodeJS. I would like to use a custom handler for the same.

Example: in the CAP CDS folder srv, I have following file

TestService.cds (Contents)

namespace test.ns.srv;

service TestService {

       function testFunction() returns Integer;

How should the implementation in TestImplementation.js look? All examples show the service without a namespace and the handler looks like this 

class TestService extends cds.ApplicationService {

    ........

    this.on("testFunction", async (req) => { });

The above construct works perfectly fine when the TestService.cds definition does not have a namespace. But with namespace, CDS does not link the handler implementation with the service.

Thank you


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK