Working with the Recipe

The Cook is responsible for retrieving all the data required to build a publication web page. In order to carry out this job, the Cook follows a recipe. The default recipe delivered with the start pack is a very small Javascript file, cue-front/recipe/recipe.js.

The reason the recipe is so small is that all the recipe functionality is actually provided by recipe extensions. The extensions are Javascript modules included by the recipe, most of which are downloaded from CCI Europe's NPM server, npm.escenic.com. The extensions that need to be downloaded from npm.escenic.com are listed in the file cue-front/recipe/package.json along with various other Javascript dependencies.

The recipe is responsible for:

  • Retrieving data from all back-end systems: the Content Store, the Solr server plus any other external systems used by your application

  • Filtering and organizing the retrieved data to produce the final JSON data structure delivered to the Waiter.

Much of the recipe's work is done by GraphQL queries, and therefore a great deal of customization work can be done using GraphQL (see Working with GraphQL) and data sources (see Using Data Sources). At many installations, the recipe itself will never need to be modified.

You may in some cases need to modify the behavior of a recipe extension by setting a configuration parameter. For information on how to do this, see Configuring Recipe Extensions.

Larger customizations may require changes to the recipe, for example:

  • Retrieving data from external systems: you might need to get sports results or weather data from an external web service.

  • Restructuring the output JSON data: your Waiter might be an existing front end system that requires the JSON data to be supplied in a predefined format. GraphQL supports simple modifications to the output structure, such as omitting elements and renaming, but not complex reorganization.

Such changes can usually be made by writing your own extension.