The gatsby-node.js API file
Code in the file
gatsby-node.js is run once in the process of building your site. You can use it to create pages dynamically, add nodes in GraphQL, or respond to events during the build lifecycle. To use the Gatsby Node APIs, create a file named
gatsby-node.js in the root of your site. Export any of the APIs you wish to use in this file.
Every Gatsby Node API passes a set of Node API helpers. These let you access several methods like reporting, or perform actions like creating new pages.