Connecting Next.js and Strapi in Docker

All resolved! Just an issue with my variable namings being incorrect - should have been data.data.attributes.x instead of just a single data. I have now renamed the data variable so it’s less confusing…

export async function getStaticProps() {
  const content = await axios.get(`${process.env.db}/home`)
  const raw = await content.data

  return {
    props: {
      siteTitle: raw.data.attributes.title,
      dates: raw.data.attributes.dates,
      content: raw.data.attributes.content,
    },
  }
}

Many thanks for everyone’s help!

1 Like