This project is a demonstration of GraphQL API implementation using AWS Lambda and Serverless framework. It focuses mainly on the GraphQL API implementation and not on the data storage. The data is stored in a simple JSON file to allow for easy local development and testing.
- Node.js
16.19.0
or higher - npm
8.1.0
or higher
git clone git@gitlab.com:goniszewski/graphql-demo.git
npm install
3. Start the local development server or call the lambda function locally using the serverless framework
npm run start:node-local
And then open http://localhost:4000/ to view the GraphQL Playground in the browser.
OR
npm run start:serverless-local
And check the output in the terminal.
Run the tests using the following command:
npm run test
All validators and the JSON API datasource are tested. The tests are run using the Jest framework.
You can also find code coverage report in the coverage/
directory.
The project is deployed to AWS Lambda using the Serverless framework. Keep in mind that the project is not configured to use any real data storage, so the data will only be available during the lifetime of the lambda function.
Ideally, the project should use a real data storage, such as DynamoDB. For more information about this integration, pleas refer to the Amazon DynamoDB and Serverless guide.