Here are a few recommendations that we should follow while working on storefront implementation.
- Do Controller Renderings - Don't do View Renderings- View renderings require hardcoded paths to the view being required to be rendered by a controller. Instead, use Controller Renderings as both Storefronts have multi-shop support. That is, based on the given shop name, it will pick a difference storefront view root directory.
- Use View Models Instead of Domain Objects -View Models should be passed into the view rendering process instead of native connector entities. These views should expose an independent view of the data that does not expose any native entity. This creates a clean separation between the connectors and the storefront and therefore allowing to share the implementation across multiple external commerce system. Views and its models should reside in the Common library and the initialization should be done in the Storefront.
- JSON Responses Must Not Contain Domain Objects Same reason as the View Models section above.
- Respect the Controller, Manager, Connect API Pattern This was mentioned earlier in the document and is worth mentioning it a second time. Respect the pattern, manager’s allow to isolate the business logic and can be easily shared. Controllers manage the request and formats the output, managers take care of the business logic and call the Connect API and return the response., Connect calls the external commerce system.
No comments:
Post a Comment