SAP CAP Blog Posts
cancel
Showing results for 
Search instead for 
Did you mean: 
qmacro
Developer Advocate
Developer Advocate
606

When embracing local-first development and using cds watch, we're actually using a convenience shortcut for:

cds serve all --with-mocks --in-memory?

That --with-mocks option for cds serve is described thus:

--with-mocks

  Use this in combination with the variants serving multiple services.
  It starts in-process mock services for all required services configured
  in package.json#cds.requires, which don't have external bindings
  in the current process environment.
  Note that by default, this feature is disabled in production and must be
  enabled with configuration 'features.mocked_bindings=true'.

Details of services that are provided by such server processes (or servers involved explicitly via cds mock, which is essentially another convenience shortcut for cds serve --mocked ...) are written to a special binding file which is for local-development only.

This binding file, also referred to as the "registry", is also read by other local server processes which require services, to see what's already available.

Technically the use of the bindings file is from --with-bindings which is described thus:

--with-bindings

  Use this option in local tests, to have all services provided by a
  process registered with their physical urls in a temporary file.
  All required services are bound automatically upon bootstrapping.
  Option --with-mocks subsumes this option.

i.e. if --with-mocks is used, then --with-bindings is implicit.

We can tell that this registry is for local-development just by looking at the file's location and name. Its location is in the developer user's home directory (very un-cloud-like), and its name starts with a dot (.), indicating it's a hidden file.

What is this file's name (don't include any directory prefix parts to it)?

This is a question from the June Developer Challenge on CAP Knowledge. And don't forget: always submit your answer as a hash, on its own - read the Taking part section of the intro post for more info. At the end of today, this question will be updated with links to further reading on this topic.

Further info:

25 Comments