cds-plugin-handlers

1.0.2 • Public • Published

CDS-PLUGIN-HANDLERS

CAP CDS Plugin that enables classes for entities.

Installation

npm install cds-plugin-handlers

Usage

Create a folder "handlers" in the "src" folder. Inside the "handlers" folder you have to create a folder for each service, e.g.: "CatalogService" for the service CatalogService. In here, you have to create a handler class for each entity, e.g.: "BooksHandler" for the entity Books.

This plugin also allows you to implement separation by concerns when it comes to external services. All requests to external services or even to different databases can be stored in a folder "services". In here, you have to create a service class for each external service to implement all the needed requests.

The folder structure in the "srv" folder should look like this.

srv
├── src
│   └── handlers
|   |        ├── CatalogService
|   |        |        ├── BooksHandler.ts
│   |        |        └── AnyOtherHandlerY.ts
│   |        └── AnyOtherService
│   |                 └── AnyOtherHandlerX.ts
|   └── services
│           ├── BookService.ts
│           └── AnyOtherServiceX.ts
└── cat-service.cds

Documentation

We have documented this approach already before the plugin but the documentation still applies, only the setup changed. Everthing is explained in the following blog posts:

Demo app

Demo app available on GitHub https://github.com/lemaiwo/cds-plugin-handlers/tree/main/sample

Demo project using services: https://github.com/lemaiwo/ReCAPBTPServiceOverview

Package Sidebar

Install

npm i cds-plugin-handlers

Weekly Downloads

9

Version

1.0.2

License

MIT

Unpacked Size

106 kB

Total Files

32

Last publish

Collaborators

  • lemaiwo