Skip to Content
Technical Articles
Author's profile photo Milton Chandradas

How to implement custom handlers – Cloud Application Programming Model

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:

 

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/

 

 

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Patricia Crouch
      Patricia Crouch

      Very informative post. Super

      Author's profile photo TC Venkatesan
      TC Venkatesan

      Very much reusable topic. Thanks for the post