Skip to content

Commit 4da2ae8

Browse files
authored
Update Apollo Server code snippet (#1969)
* Update Apollo Server code snippet Resolves #1078 * Prettier
1 parent a45a2d5 commit 4da2ae8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/code/language-support/javascript/server/apollo-server.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@ Then run `node server.js` with this code in `server.js`:
1717
```js
1818
import { ApolloServer } from "@apollo/server"
1919
import { startStandaloneServer } from "@apollo/server/standalone"
20-
import { buildSchema } from "graphql"
2120

22-
const schema = buildSchema(`
23-
type Query {
24-
hello: String
25-
}
26-
`)
21+
// The GraphQL schema
22+
const typeDefs = `#graphql
23+
type Query {
24+
hello: String
25+
}
26+
`
2727

28+
// A map of functions which return data for the schema.
2829
const resolvers = {
2930
Query: {
30-
hello: () => "Hello World!",
31+
hello: () => "world",
3132
},
3233
}
3334

@@ -37,7 +38,6 @@ const server = new ApolloServer({
3738
})
3839

3940
const { url } = await startStandaloneServer(server)
40-
4141
console.log(`🚀 Server ready at ${url}`)
4242
```
4343

0 commit comments

Comments
 (0)