Hi All,
I have 2 service layers in CAP project. One service layer is a CDS based service layer and another is Express based service layer (Both are NodeJS). The project structure is somewhat like this:
db
- data-model.cds
srv1
- x.cds
- x.js
srv2
- server.js
Thanks,
Harish
Request clarification before answering.
Hi Harish,
You can change the CAP configuration for standard folders in your package.json. In your case add something like
"cds": {
"folders":{"srv": "srv1/"},
...This will change the default "srv/" for the service folder to "srv1/". "cds watch" is now listening to srv1/.
Similarly, you can change the defaults for "db/" and "app/". Just enter the "cds env" command (or "cds env ls folders")
to check the effective configuration.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not sure what you mean by "layers". Maybe you are fine with setting
"folders":{"srv": "srv2/"},and within your server.js, load and start the services from srv1/ "manually" using the CDS API (https://cap.cloud.sap/docs/node.js/api)
Hi Harish,
There are multiple functionalities delivered to you when you invoke the CLI command CDS watch.
First is that nodemon is invoked -- this is the node module responsible for listening to your changes in javascript and cds files.
Second is the invoking of cds run command. cds run command is heavily reliant on your CAP Model project and hence you can't use this in your regular express based node module.
I'm guessing you wanted the capability of nodemon available to your regular node module project? If that's the case then just setup the "start" script of your express based node module with nodemon -- below is my usual setup:
"dev": "nodemon ./server.js",
And of course, you need to have nodemon as your devDependencies.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.