import type { NextPage } from "next"; import { request, gql } from "graphql-request"; interface Props { posts: { id: string; title: string; content: string; }[]; } const query = gql` { post { content id title } } `; export async function getStaticProps() { const { post: posts } = await request( "http://localhost:8080/v1/graphql", query ); return { props: { posts, }, }; } const Home: NextPage = ({ posts }) => { return (
{posts.map((post) => (

{post.title}

{post.content}

))}
); }; export default Home;