@@ -178,19 +178,32 @@ cds.on('bootstrap', app => {
178
178
179
179
Emitted whenever a CDS model got loaded using ` cds.load() `
180
180
181
+ ``` js twoslash
182
+ // @noErrors
183
+ const cds = require (' @sap/cds' )
184
+ cds .on (' loaded' , model => { /* ... */ })
185
+ ```
181
186
182
187
183
188
### connect {.event}
184
189
185
190
Emitted for each service constructed through [ ` cds.connect ` ] ( cds-connect ) .
186
191
187
-
192
+ ``` js twoslash
193
+ // @noErrors
194
+ const cds = require (' @sap/cds' )
195
+ cds .on (' connect' , service => { /* ... */ })
196
+ ```
188
197
189
198
### serving {.event}
190
199
191
200
Emitted for each service constructed by [ ` cds.serve ` ] ( cds-serve ) .
192
201
193
-
202
+ ``` js twoslash
203
+ // @noErrors
204
+ const cds = require (' @sap/cds' )
205
+ cds .on (' serving' , service => { /* ... */ })
206
+ ```
194
207
195
208
### served {.event}
196
209
@@ -199,7 +212,7 @@ A one-time event, emitted when all services have been bootstrapped and added to
199
212
``` js twoslash
200
213
// @noErrors
201
214
const cds = require (' @sap/cds' )
202
- cds .on (' served' , (services )=> {
215
+ cds .on (' served' , async (services ) => {
203
216
// We can savely access service instances through the provided argument:
204
217
const { CatalogService , db } = services
205
218
// ...
@@ -213,6 +226,11 @@ This event supports _asynchronous_ event handlers.
213
226
214
227
A one-time event, emitted when the server has been started and is listening to incoming requests.
215
228
229
+ ``` js twoslash
230
+ // @noErrors
231
+ const cds = require (' @sap/cds' )
232
+ cds .on (' listening' , ({ server, url }) => { /* ... */ })
233
+ ```
216
234
217
235
218
236
### shutdown {.event}
@@ -221,6 +239,11 @@ A one-time event, emitted when the server is closed and/or the process finishes.
221
239
222
240
This event supports _ asynchronous_ event handlers.
223
241
242
+ ``` js twoslash
243
+ // @noErrors
244
+ const cds = require (' @sap/cds' )
245
+ cds .on (' shutdown' , async () => { /* ... */ })
246
+ ```
224
247
225
248
226
249
0 commit comments