{"size": 1328, "ext": "js", "max_stars_repo_path": "gridsome.server.js", "max_stars_repo_name": "joe-irving/yorkpsc-gridsome", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gridsome.server.js", "max_issues_repo_name": "joe-irving/yorkpsc-gridsome", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gridsome.server.js", "max_forks_repo_name": "joe-irving/yorkpsc-gridsome", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.5384615385, "max_line_length": 77, "alphanum_fraction": 0.547439759}
// Server API makes it possible to hook into various parts of Gridsome
// on server-side and add custom data to the GraphQL data layer.
// Learn more: https://gridsome.org/docs/server-api/

// Changes here require a server restart.
// To restart press CTRL + C in terminal and run `gridsome develop`

module.exports = function (api) {
  api.loadSource(({ getCollection }) => {
    // Use the Data Store API here: https://gridsome.org/docs/data-store-api/
  })

  api.createPages(async ({graphql, createPage}) => {
    // Use the Pages API here: https://gridsome.org/docs/pages-api/
    const { data } = await graphql(`{
      allStoryblokEntry {
        edges {
          node {
            id
            full_slug
          }
        }
      }
    }`)
    // console.log(`Data: ${JSON.stringify(data)}`)

    data.allStoryblokEntry.edges.forEach( ({ node }) => {
      if (node.full_slug === 'home'){
        createPage({
          path: '/',
          component: './src/templates/StoryblokEntry.vue',
          context: {
            id: node.id
          }
        })
      }
      createPage({
        path: `/${node.full_slug}`,
        component: './src/templates/StoryblokEntry.vue',
        context: {
          id: node.id
        }
      })
    })
  })

  // api.createPages(({ createPage }) => {
  //
  //
  // })
}
