Skip to content

Commit 5c9c1c9

Browse files
danjoaCopilot
andcommitted
polished section on event handlers
Co-authored-by: Copilot <copilot@github.com>
1 parent 98d7c48 commit 5c9c1c9

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

node.js/core-services.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -524,24 +524,23 @@ class BooksService extends cds.ApplicationService {
524524

525525
**Argument `event`** can be one of:
526526

527-
- `'CREATE'`, `'READ'`, `'UPDATE'`, `'UPSERT'`,`'DELETE'`
528-
- `'INSERT'`,`'SELECT'`as aliases for: `'CREATE'`,`'READ'`
529-
- `'POST'`,`'GET'`,`'PUT'`,`'PATCH'`as aliases for: `'CREATE'`,`'READ'`,`'UPDATE'`
530-
- `'each'`shorthand for `.after` `'READ'` handler ran for _each_ result entry
531-
- Any other string name of a custom action or function – for example, `'submitOrder'`
532-
- An `array` of the above to register the given handler for multiple events
533-
- The string `'*'` to register the given handler for *all* potential events
534-
- The string `'error'` to register an error handler for *all* potential events
527+
- String `CREATE`, `READ`, `UPDATE`, `UPSERT`, `DELETE`
528+
- String `SELECT`, `INSERT`aliases for: `READ` and `CREATE`
529+
- String `GET`, `PUT`, `POST`, `PATCH`aliases for: `READ`, `CREATE`, `UPDATE`
530+
- String `each`shorthand for `.after` `READ` handler ran for _each_ result entry
531+
- String `error` to register an error handler for *all* potential events
532+
- A name of a custom action or function – for example, `submitOrder`
535533

536534
**Argument `entity`** can be one of:
537535

538536
- A `CSN definition` of an entity served by this servicei.e., from [`this.entities`](#entities)
539537
- A `string` corresponding to the _name_ of an entity served by this service
540-
- A `path` navigating from a served entity to associated onese.g., `'Books/author'`
541-
- An `array` of the above to register a handler for multiple entities / paths
542-
- The string `'*'` to register a handler for *all* potential entities / paths
538+
- A `path` navigating from a served entity to associated onese.g., `Books/author`
543539

540+
**Multiple `events` or `entities`**for both parameters, you can also specify:
544541

542+
- An `array` of the above to register a handler for _multiple_ events or entities
543+
- String `*` to register a handler for _all_ potential events or entities.
545544

546545
::: tip Best Practices
547546

0 commit comments

Comments
 (0)