Hi CAP-Team,
I noticed that in the incidents submodule, inside the srv folder, we have a custom server.js.
When running cds watch directly in the incidents folder, the custom server.js is executed as expected (see screenshot below, no. 1). However, when starting cds watch from the root directory (as described in step 2 of the tutorial), the custom server.js is not called (see screenshot below, no. 2).
Steps to Reproduce
- Go to the
incidents/srv folder.
- Add a log line inside
server.js (for example at line 16):
console.log("=== CALLED CUSTOM SERVER.JS ===");
- Run
cds watch inside the incidents folder → the log appears.
- Run
cds watch from the project root (tutorial step 2). The log does not appear.
Expected Behavior
When running cds watch from the root, the custom server.js files inside the services should also be executed (or there should be a documented way to enable this).
Actual Behavior
The custom server.js is only executed when cds watch is run directly inside the incidents folder, not when running from root.
Is there a recommended way to ensure custom server.js in services are also executed when running cds watch from the root? This is mostly relevant for local development. In deployment scenarios, each service runs in its own container, so the issue does not occur. Still, it would be helpful to know the best practice here.
Thank you & kind regards
Johannes
Hi CAP-Team,
I noticed that in the incidents submodule, inside the
srvfolder, we have a customserver.js.When running cds watch directly in the
incidentsfolder, the customserver.jsis executed as expected (see screenshot below, no. 1). However, when startingcds watchfrom therootdirectory (as described in step 2 of the tutorial), the customserver.jsis not called (see screenshot below, no. 2).Steps to Reproduce
incidents/srvfolder.server.js(for example at line 16):cds watchinside theincidentsfolder → the log appears.cds watchfrom the projectroot(tutorial step 2). The log does not appear.Expected Behavior
When running
cds watchfrom the root, the customserver.jsfiles inside the services should also be executed (or there should be a documented way to enable this).Actual Behavior
The custom
server.jsis only executed whencds watchis run directly inside theincidentsfolder, not when running fromroot.Is there a recommended way to ensure custom
server.jsin services are also executed when running cds watch from the root? This is mostly relevant for local development. In deployment scenarios, each service runs in its own container, so the issue does not occur. Still, it would be helpful to know the best practice here.Thank you & kind regards
Johannes