081b8fba67
Closes https://github.com/vercel/next.js/issues/42769 ## Description This PR address https://github.com/vercel/next.js/issues/42769 by updating the `api-routes-apollo-server`, `api-routes-apollo-server-and-client` and `api-routes-apollo-server-and-client-auth` examples to use Apollo Server 4 and [@as-integrations/next](https://github.com/apollo-server-integrations/apollo-server-integration-next), which is the Apollo Server Next integration package. The PR also updates the three examples to use Typescript. The functionality of the examples is the same. ## Documentation / Examples - [X] Make sure the linting passes by running `pnpm build && pnpm lint` - [X] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) closes https://github.com/vercel/next.js/pull/33545 closes https://github.com/vercel/next.js/pull/30082 closes https://github.com/vercel/next.js/issues/21984 closes #10413
32 lines
613 B
TypeScript
32 lines
613 B
TypeScript
import Link from 'next/link'
|
|
|
|
import queryGraphql from '../shared/query-graphql'
|
|
|
|
export default function UserListing({ users }) {
|
|
return (
|
|
<div>
|
|
<h1>User Listing</h1>
|
|
<ul>
|
|
{users.map((user) => (
|
|
<li key={user.username}>
|
|
<Link href="/[username]" as={`/${user.username}`}>
|
|
{user.name}
|
|
</Link>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export async function getStaticProps() {
|
|
const { users } = await queryGraphql(`
|
|
query {
|
|
users {
|
|
name
|
|
username
|
|
}
|
|
}
|
|
`)
|
|
return { props: { users } }
|
|
}
|