-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EXAMPLES] Update with-apollo-neo4j-graphql (#44570)
We replace neo4j-graphql-js with @neo4j/graphql and update Apollo server to version 4. This refactor also changes the code from Javascript to Typescript. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## 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)
- Loading branch information
Showing
22 changed files
with
146 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
...ith-apollo-neo4j-graphql/apollo/client.js → ...ith-apollo-neo4j-graphql/apollo/client.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Neo4jGraphQL } from '@neo4j/graphql' | ||
import typeDefs from './type-defs' | ||
import getDriver from '../util/neo4j' | ||
|
||
const driver = getDriver() | ||
|
||
export const neoSchema = new Neo4jGraphQL({ | ||
typeDefs, | ||
driver, | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { gql } from '@apollo/client' | ||
|
||
export default gql` | ||
type Movie { | ||
title: String | ||
tagline: String | ||
released: Int | ||
actors: [Person!]! @relationship(type: "ACTED_IN", direction: IN) | ||
directors: [Person!]! @relationship(type: "DIRECTED", direction: IN) | ||
} | ||
type Person { | ||
name: String | ||
born: Int | ||
movies: [Movie!]! @relationship(type: "ACTED_IN", direction: OUT) | ||
} | ||
` |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...apollo-neo4j-graphql/components/header.js → ...pollo-neo4j-graphql/components/header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
webpack: (config) => { | ||
// this will override the experiments | ||
config.experiments = { ...config.experiments, topLevelAwait: true } | ||
// this will just update topLevelAwait property of config.experiments | ||
// config.experiments.topLevelAwait = true | ||
return config | ||
}, | ||
} | ||
|
||
module.exports = nextConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
...s/with-apollo-neo4j-graphql/pages/_app.js → .../with-apollo-neo4j-graphql/pages/_app.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
import '../styles/globals.css' | ||
import { ApolloProvider } from '@apollo/client' | ||
import { useApollo } from '../apollo/client' | ||
import globalStyles from '../styles/global' | ||
import type { AppProps } from 'next/app' | ||
|
||
export default function MyApp({ Component, pageProps }) { | ||
export default function MyApp({ Component, pageProps }: AppProps) { | ||
const apolloClient = useApollo(pageProps.initialApolloState) | ||
return ( | ||
<ApolloProvider client={apolloClient}> | ||
<Component {...pageProps} /> | ||
<style jsx global> | ||
{globalStyles} | ||
</style> | ||
</ApolloProvider> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ApolloServer } from '@apollo/server' | ||
import { startServerAndCreateNextHandler } from '@as-integrations/next' | ||
import { neoSchema } from '../../apollo/schema' | ||
|
||
const server = async (): Promise<ApolloServer> => { | ||
const schema = await neoSchema.getSchema() | ||
return new ApolloServer({ schema }) | ||
} | ||
|
||
export default startServerAndCreateNextHandler(await server()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
html, | ||
body { | ||
padding: 0; | ||
margin: 0; | ||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, | ||
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; | ||
} | ||
|
||
a { | ||
color: inherit; | ||
text-decoration: none; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
} |
Oops, something went wrong.