Skip to content

How to run custom server.js in services when using cds watch from root? #3

Description

@thisisevanfox

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).

Image

Steps to Reproduce

  1. Go to the incidents/srv folder.
  2. Add a log line inside server.js (for example at line 16):
console.log("=== CALLED CUSTOM SERVER.JS ===");
  1. Run cds watch inside the incidents folder → the log appears.
  2. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions