service-handlers
Installation
SKILL.md
Service Handlers — CAP Best Practices
Primary reference: https://cap.cloud.sap/docs/node.js/core-services Event handlers: https://cap.cloud.sap/docs/node.js/events
Handler registration patterns
// Preferred: class-based handler (collocate logic, testable)
module.exports = class CatalogService extends cds.ApplicationService {
async init() {
const { Products } = this.entities
this.before('CREATE', Products, this.validateProduct)
this.on('submitOrder', this.onSubmitOrder)
this.after('READ', Products, this.enrichProducts)
return super.init() // always call super.init()!
}