I'm curious if it's possible to set up GraphQL in Next.js similar to how it's done in Gatsby, allowing me to query pages and retrieve data from them. Are there any plugins available for Next.js that work like Gatsby-file-source and gatsby-markdown-remark? For instance:
`export const query = graphql`
query($slug: String!) {
mdx(frontmatter: { slug: { eq: $slug } }) {
frontmatter {
tags
slug
title
date
country
categories
}
}
}`
This approach would allow me to query all the mdx files in my project and extract their frontmatter for use and storage.
It seems that Gatsby somehow transforms the files into nodes that can be read and queried through GraphQL.