Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Exam B2C Commerce Developer Topic 4 Question 87 Discussion

Actual exam question for Salesforce's B2C Commerce Developer exam
Question #: 87
Topic #: 4
[All B2C Commerce Developer Questions]

A developer needs to perform the same additional checks before completing multiple routes in a custom controller, in order to decide whether to render a template or redirect the user to a different page.

According to SFRA best practices, what is the correct approach to improve code reusability in this scenario7

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

Reed
5 days ago
Appending a new function to all the routes? That's just adding more complexity and making the code harder to maintain. Definitely not the best solution here.
upvoted 0 times
...
Ronnie
10 days ago
But wouldn't creating a controller in a separate new cartridge be a better option for code reusability?
upvoted 0 times
...
Nelida
14 days ago
A middleware function sounds like the perfect way to encapsulate the common logic and improve code reusability. It's a much cleaner approach than modifying the existing routes.
upvoted 0 times
...
Clorinda
17 days ago
I disagree, I believe appending a new function to all the existing routes with the server module is the way to go.
upvoted 0 times
...
Ronnie
20 days ago
I think the correct approach is to define a new middleware function and use it in the existing routes.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77