Apollo server micro with type-graphql
First, run the development server:
npm run dev
# or
yarn dev
for example query:
gql`
query Posts {
posts {
id
title
}
}
`;
will produce hook const { data, loading, error } = usePostsQuery();
yarn build
of yarn dev
will generate /src/graphql/api.tsx
for client side and /src/graphql/api-ssr.tsx
for server side automatically
Open http://localhost:3000 with your browser to see the result.