When an existing SFRA route already performs the required core processing and the developer only needs to add functionality after that processing,server.append()is the appropriate route-extension mechanism.
Salesforce documents thatserver.appendadds middleware after an existing route ' s middleware chain. The original middleware executes first, followed by the appended middleware. A common documented use case is adding or modifying properties in the route ' sviewDataobject without duplicating the existing controller implementation.
server.extend()is important when a custom controller inherits routes frommodule.superModule, but it is not by itself the operation that adds a new step to a specific route. Option B replaces more behavior than necessary and increases coupling to the underlying implementation.
With an appended function, the developer can retrieve ViewData usingres.getViewData(), add the required properties, update it throughres.setViewData(), and callnext().
The technique preserves the base route and minimizes custom code, supporting upgrade-safe SFRA development.
Study Guide reference:Application Development — SFRA controller customization,server.append(), middleware chains, ViewData,module.superModule, and route extensibility.
===============