Back to Templates
This workflow is a hands-on tutorial for the Code node in n8n, covering both basic and advanced concepts through a simple data processing task.
Run Once for Each Item
): The first Code node iterates through each user to calculate their fullName
and age
. This demonstrates basic item-by-item data manipulation using $input.item.json
.this.helpers.httpRequest
function to call an external API (genderize.io) to enrich the data with a predicted gender.Run Once for All Items
): The third Code node receives the fully enriched list of users and runs only once. It uses $items()
to access the entire list and calculate the averageAge
, returning a single summary item.Buffer
in JavaScript.Setup time: < 1 minute
This workflow is a self-contained tutorial and requires no setup.
1. Sample Data
node, or modify the code in the Code nodes to see what happens.