Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
miltonc
Product and Topic Expert
Product and Topic Expert
Github repository:

To be published soon...

 

Introduction:

  • In this session, we will look at how we can implement custom handlers in Cloud Application Programming Model


 

Synopsis:

  • CAP model provides generic handlers that takes care of all the CRUD functionality right out-of-the-box

  • Sometimes, this may be enough for your business needs, but other times you may need to do more based on business requirements

  • We can add custom middleware functions that can run before, after or even instead of the generic handler


 

Steps:

  • In this example, we will start with a basic custom handler that logs all requests that are sent to the OData Service

  • Then we will add another custom handler that runs only for the Users entity - We will add a business requirement that all passwords need to be stored encrypted

  • We will make use of bcryptjs npm package to encrypt the password and store it in our SAP HANA database


 

Youtube link:

https://youtu.be/YlHHmZxelmw

 

Conclusion:

  • This video should give you a clear idea on how to implement custom handlers in Cloud Application Programming Model

  • You can have multiple custom handlers that can run for the same entity before or after the generic handler

  • In the next video, we will look at a more complex scenario involving the _req object and also how to debug and set breakpoints in our code

  • If you have any questions or comments, please list them below and I will be happy to answer


 

Next post:

https://blogs.sap.com/2020/08/23/how-to-implement-functions-cloud-application-programming-model/

 

Previous post:

https://blogs.sap.com/2020/08/23/how-to-add-support-for-sap-hana-cloud-application-programming-model...

 

 
2 Comments