Skip to content

Commit 8888b5a

Browse files
committed
chore(deps): upgrade to Apollo Server 5, Prisma 7, and graphql 16
Major dependency updates: - apollo-server 3.x → @apollo/server 5.x - @prisma/client 4.x → 7.x (with driver adapter pattern) - graphql 15.x → 16.x - ava 4.x → 6.x Breaking changes addressed: - Apollo Server: use startStandaloneServer(), import gql from graphql-tag - Prisma 7: add prisma.config.ts, use @prisma/adapter-better-sqlite3 - Tests: update executeOperation() response structure Removed deprecated packages: - apollo-server (replaced by @apollo/server) - apollo-server-fastify (unused) Also fixes typo in test assertion message.
1 parent eb95fc0 commit 8888b5a

13 files changed

Lines changed: 3120 additions & 5139 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ It's also accessing data from elsewhere, to demonstrate how GraphQL combines mul
77

88
## Technologies involved
99

10-
- Node 15.3+ (because of [modules](https://blog.logrocket.com/es-modules-in-node-today/) and [top-level async/await](https://www.stefanjudis.com/today-i-learned/top-level-await-is-available-in-node-js-modules/#top-level-%60await%60-is-available-%22unflagged%22-in-node.js-since-%60v14.8%60))
11-
- [Apollo Server](https://www.apollographql.com/docs/apollo-server/getting-started/) (the GraphQL part)
12-
- [Prisma](https://github.com/prisma/prisma) (for the SQL part)
10+
- Node 20+ (required by Apollo Server 5 and Prisma 7)
11+
- [Apollo Server 5](https://www.apollographql.com/docs/apollo-server/getting-started/) (the GraphQL part)
12+
- [Prisma 7](https://github.com/prisma/prisma) (for the SQL part, using the driver adapter pattern)
1313
- Axios (to call a Poem API as the second data source)
1414

1515
Also a few development convenience things, like [Nodemon](https://www.npmjs.com/package/nodemon) and the [prisma cli](https://www.prisma.io/docs/reference/api-reference/command-reference/).
@@ -49,7 +49,7 @@ It gives us everything we need to handle GraphQL stuff:
4949
- It provides us with ways to assemble schema Type Definitions
5050
- It also gives us a way to hook in our resolvers that will get the data and send query responses back to the client.
5151
- As a convenience, it also gives us the `gql` string template to parse the GraphQL schema notations.
52-
- Finally, it comes with GraphQL Playground out of the box, which is handy during development.
52+
- Finally, it comes with Apollo Sandbox out of the box, which is handy during development.
5353

5454
### SQL
5555

@@ -75,7 +75,7 @@ NOTE: You can reset the SQLite DB anytime by running `npm run resetDB`.
7575

7676
## Run some queries
7777

78-
Apollo Server comes with a querying UI out of the box.
78+
Apollo Server comes with Apollo Sandbox, a querying UI, out of the box.
7979

8080
Simply visit http://localhost:3000 and execute a GraphQL query, e.g.:
8181

@@ -88,4 +88,4 @@ Simply visit http://localhost:3000 and execute a GraphQL query, e.g.:
8888
- [x] Add a diagram of the architecture
8989
- [x] Document code more comprehensively
9090
- [x] Finish ReadMe
91-
- [ ] Maybe add a few tests?
91+
- [x] Add tests (run with `npm test`)

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { server } from './src/server.js'
2+
import { startStandaloneServer } from '@apollo/server/standalone'
23
import { ensureSeedData } from './src/providers/booksDB/index.js'
34

45
// launch the server
5-
const { url } = await server.listen(process.env.PORT || 3000)
6+
const { url } = await startStandaloneServer(server, {
7+
listen: { port: parseInt(process.env.PORT) || 3000 }
8+
})
69

710
// ensure that some seed data exists (e.g. on first launch)
811
await ensureSeedData()

0 commit comments

Comments
 (0)