I have started working with gatsby and graphQL and am trying to fetch dat from rest API. I am able to loop through data and log it into console. However when using graphQL i am only getting one result. Please see my code below. I appreciate any help on what I am doing wrong.
exports.sourceNodes = async ({ boundActionCreators }) => {
 const { createNode } = boundActionCreators;
  console.log(createNode)
 const fetchData = () => axios.get(url)
 const res = await fetchData();
 console.log(res.data);
 res.data.blogArticle.forEach((article, index) => {
  return createNode({
   ...article,
   id: `£{index}`,
   children: [],
   parent: `__SOURCE__`,
   internal: {
    type: `BlogArticle`,
    content: JSON.stringify(article),
    contentDigest: crypto
     .createHash(`md5`)
     .update(JSON.stringify(article))
     .digest(`hex`)
   },
   heading: article.heading,
   subheading: article.subheading,
   content: {
    text: article.content.text,
    videoURL: article.content.videoURL,
    imageURL: article.content.imageURL
   }
  });
 });
 res.data.emptyLegs.forEach((leg, index) => {
  const emptyLegNode = {   
   from: leg.From,
   to: leg.To,
   aircraft: leg.Aircraft,
   seats: leg.Seats,
   date: leg.Date,
   price: leg.Price,
   id: `£{index}`,
   children: [],
   parent: `__SOURCE__`,
   internal: {
    type: `EmptyLegs`,
    contentDigest: crypto
     .createHash(`md5`)
     .update(JSON.stringify(res.data.emptyLegs))
     .digest(`hex`)
   },
  };
  createNode(emptyLegNode);
 });
 return;
};
 
     
    