Enrich data from a backend

If you want to load additional data for a data source (such as a product list), you can use a decorator to do so. The general approach for this is as follows:

  • Hook into one or more after* decorator methods
  • In there, load the corresponding data
  • Add the data to the resulting Frontastic data objects using the projectSpecificData property

For example, if you want to load recommendations for a product to be displayed on the product details page you'd hook into the afterGetProduct() hook, use the delivered Product data to call an additional HTTP endpoint for data fetching and put the data on Product.projectSpecificData.

🚧

Don't execute expensive or multiple API calls on frequently used data source implementations. Such calls will cause significant delays and potentially cause bottlenecks in your start page if this uses product lists. If you feel the need to do so, use the Request path to limit the expensive calls to pages which actually require the data.