cancel
Showing results for 
Search instead for 
Did you mean: 

Tutorial "Create a CAP Business Service with Node.js ..." Step 10 - 'Custom logic' not working

AndreasMuno
Product and Topic Expert
Product and Topic Expert
0 Kudos

Tutorial "Create a CAP Business Service with Node.js Using Visual Studio Code"

Hi tutorial experts,

I was able to solve all other challenges of this tutorial, but the last step 10, "Add custom logic", appears to not work for me. The code is there (the linter asked for the first line of the cat-service.js file to be replaced with "export default (srv) => {" to make it an ES, but that does not solve the issue either).

In file test.http I press button 'Send Request' to order 5 copies of book '201', "Wuthering Heights".

The response code is 204, 'No content'.

When re-testing the number of books with 'Send Request' for the Browse Books request, there is no change in the number of books on stock, 12.

I did vary the 'amount' number in the order function to '0' and '12' to get the javascript module to respond with an error message, but there is no different response. They all look like this

What do you guys suggest I try out next?

rene.jeglinsky, chuergo16 , daniel.wroblewski , joshua.margo,

Accepted Solutions (1)

Accepted Solutions (1)

gregorw
Active Contributor
0 Kudos

Hi Andreas,

I've followed the tutorial and created the GitHub repository my-bookshop based on it. When I test it all works as described. Can you please check if in the output when you run cds watch you find:

[cds] - serving CatalogService { path: '/odata/v4/catalog', impl: 'srv/cat-service.js' }

?

Best Regards
Gregor

AndreasMuno
Product and Topic Expert
Product and Topic Expert

Thank you, Gregor,

I re-started the entire implementation of this tutorial from scratch, and now everything works exactly as it should. Amazing. Miraculous.

Thank you for your unrelenting support!

-Andreas

Answers (0)