This project is a GraphQL API for a todo list application. It provides CRUD operations for managing todo items, including creating, reading, updating, and deleting todos. The API is built with Node.js, MongoDB, and AWS Lambda.
- GraphQL CRUD API for managing todo items
- Data storage with MongoDB
- Serverless architecture using AWS Lambda
- Unit and integration tests with Jest
- Deployment with Serverless Framework
- Node.js
- MongoDB
- GraphQL
- AWS Lambda
- Serverless Framework
- Jest
- Clone the repository
[email protected]:roc41d/graphql-api-with-nodejs-mongodb-lambda.git
- Install dependencies
cd graphql-api-with-nodejs-mongodb-lambda
npm install
- Set up environment variables (copy the
.env.example
file to.env
and update the values)
cp .env.example .env
cp .env.example .env.production
- Start the development server
npm run dev
The server will start locally at http://localhost:4000/.
To deploy the GraphQL API using AWS Lambda and API Gateway:
-
Set up an AWS account if you haven't already and copy your
YOUR_ACCESS_KEY
andYOUR_SECRET_KEY
. -
Install the Serverless Framework globally:
npm install -g serverless
- Build the project:
npm run build
- Configure AWS credentials with the Serverless Framework:
serverless config credentials --provider aws --key YOUR_ACCESS_KEY --secret YOUR_SECRET_KEY
- Deploy the API to AWS Lambda:
serverless deploy
The Serverless Framework will deploy the API to AWS Lambda and provide you with the endpoint URL.