GraphQL API Support (#121)#165
Open
David-patrick-chuks wants to merge 3 commits intollinsss:masterfrom
Open
Conversation
|
@David-patrick-chuks is attempting to deploy a commit to the llinsomoudu-gmailcom's projects Team on Vercel. A member of the Team first needs to authorize it. |
👷 Deploy request for taggedpay pending review.Visit the deploys page to approve it
|
Contributor
Author
@llinsss Done! I've removed package-lock.json package.json |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements a GraphQL API alongside the existing REST API, leveraging Apollo Server. It introduces the foundational GraphQL schema and resolvers for the
UserandTransactionmodels, alongside robust authentication via JWTs and a hard limit on query complexity to prevent overly expensive queries from impacting server performance.Related Issue
Closes #121
Changes
📡 GraphQL Setup & Integration
backend/graphql/schema.jsUserandTransactiontypes.me,myTransactions, andtransaction(id: ID!)queries.backend/graphql/resolvers.jsbackend/graphql/apollo.jsinitApollofunction./graphqlendpoint viaexpressMiddleware.Authorizationheader, resolving the current user.backend/server.jsinitApollosequentially during server startup, passing in the HTTP server instance for graceful draining.backend/package.json@apollo/serverandgraphqldependencies.🧪 Testing
backend/tests/graphql.test.jsVerification Results
npm test tests/graphql.test.js)How to Test
cd backend && npm run devPOST /api/auth/login).http://localhost:5000/graphqlwith anAuthorization: Bearer <token>header and a valid GraphQL query.{ "query": "query { me { id email } }" }Test Recording:
1. Jest Integration Tests Passing
Screen.Recording.2026-02-21.at.11.57.49.mov