Skip to content

Commit 4b644e5

Browse files
Enhance documentation for .add method middleware (#2246)
Clarified the types of middlewares that can be registered in the .add method. --------- Co-authored-by: René Jeglinsky <[email protected]>
1 parent 7b130d1 commit 4b644e5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

node.js/cds-serve.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,11 @@ It adds the currently active model to the continuation. It's required for all ap
252252
### .add(mw, pos?) {.method}
253253

254254
Registers additional middlewares at the specified position.
255-
`mw` must be a function that returns an express middleware.
256-
`pos` specified the index or a relative position within the middleware chain. If not specified, the middleware is added to the end.
255+
`mw` can be either of:
256+
- a function that returns an express middleware
257+
- an express middleware with the common _req_, _res_, _next_ arguments
258+
- an array of express middlewares
259+
`pos` specifies the index or a relative position within the middleware chain. If not specified, the middleware is added to the end.
257260

258261
```js
259262
cds.middlewares.add (mw, {at:0}) // to the front

0 commit comments

Comments
 (0)