When the requirement is simply to add information to an existing route ' sviewData,server.append()is the most targeted SFRA customization mechanism. The original route executes first, after which the appended middleware can callres.getViewData(), add or modify properties, and then callres.setViewData().
Salesforce ' s official SFRA customization guidance uses this exact pattern:server.appendmodifies an existing route by adding middleware that enriches theviewDataobject used for rendering. The documentation states that the original middleware chain and appended middleware both execute.
Replacing the callback is unnecessarily invasive when existing route behavior remains valid.server.extend()has a different purpose: it inherits a server object ' s routes from the super module so that those routes can then be customized; it is not itself the specific operation that adds a post-processing step to an existing route.
Therefore, the developer should extend the controller module as necessary andappendmiddleware to the relevant route to add the new ViewData property.
Study Guide reference:Application Development — SFRAserver.append, ViewData,getViewData(),setViewData(), controller extensibility, and route middleware.
===============
Submit