Skip to content

Commit 8ef2be6

Browse files
sjvanssmahatirenejeglinsky
authored
[cds^9.7] support for express 4 and 5 (#2115)
Co-authored-by: Mahati Shankar <93712176+smahati@users.noreply.github.com> Co-authored-by: Rene Jeglinsky <rene.jeglinsky@sap.com>
1 parent 85b59ba commit 8ef2be6

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

node.js/cds-facade.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,30 @@ cds.model = await cds.load('*')
301301

302302
### cds. app {.property}
303303

304-
The [express.js Application object](https://expressjs.com/de/4x/api.html#app) constructed during bootstrapping. Several framework operations use that to add express handlers or middlewares. It is initialised in built-in `server.js` like so:
304+
Bootstrapping constructs the [express.js Application object](https://expressjs.com/en/api.html#app). Several framework operations use it to add express handlers or middlewares. The built-in `server.js` file initializes it:
305305

306306
```js
307307
cds.app = require('express')()
308308
```
309309

310+
Starting from version 9.7.0, CAP Node.js supports version 5 of [`express`](https://expressjs.com/) in addition to version 4.
311+
312+
With `express^5` support, `express` became a standard dependency (instead of an [_optional peer dependency_](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#peerdependencies)) with an open range for both major versions 4 and 5 (that is, `^4 || ^5`).
313+
If you don't require a specific version (for example, due to custom middleware), you can remove your own `express` dependency and automatically receive the latest version of `express` that is compatible with all your (transitive) dependencies.
314+
315+
:::tip Verify installed version of `express`
316+
With CLI command `npm ls express`, you can verify the installed version(s) of `express`.
317+
318+
```bash
319+
xtravels % npm ls express
320+
@capire/xtravels@1.0.0
321+
└─┬ @sap/cds@9.7.0
322+
└── express@5.2.1
323+
```
324+
:::
325+
326+
For more information, refer to the [`express`](https://expressjs.com/) [_Moving to Express 5_](https://expressjs.com/en/guide/migrating-5) migration guide and the [LTS Timeline](https://expressjs.com/2025/03/31/v5-1-latest-release.html).
327+
310328
[Learn more about bootstrapping in `cds.server`.](./cds-serve){.learn-more}
311329

312330

@@ -339,7 +357,7 @@ cds.db = await cds.connect.to('db')
339357

340358
```ts
341359
function cds.error (
342-
status? : number
360+
status? : number
343361
message : string | object,
344362
details? : object
345363
caller? : function

0 commit comments

Comments
 (0)