Simple Template with Apollo Server (v4) and AWS Lambda
- Node.js v18 or superior
- Npm
- Docker and Docker Compose
- Create an AWS account
- Install the AWS CLI
- Create an IAM user
- Configure the AWS CLI
- Clone the repository:
git clone https://github.com/anopszetex/Graphql-AWS.git
- Install dependencies:
npm ci --silent
This project uses LocalStack to simulate AWS services locally. To run LocalStack, follow these steps:
- Ensure you have Docker and Docker Compose installed.
- Navigate to the root directory of the project and run:
docker-compose up -d
- Start the server:
In the root directory, run:
yarn dev
- Access the API:
The server will be running athttp://0.0.0.0:3000
query Hello {
getHero
ping
}
├── src/
│ ├─ handler.js # Main lambda function
│ ├── mocks/
│ │ ├── query.json # Mock http request locally
│ ├── graphql/
│ ├── hero/ # Hero-related GraphQL files
│ │ ├── index.js # Merges schemas and resolvers for Hero
│ │ ├── resolvers.js # Resolvers for Hero queries/mutations
│ │ └── schema.js # GraphQL schema definition for Hero
│ ├── index.js # Merges all schemas and resolvers
├── docker-compose.yml # LocalStack configuration
├── serverless.yml # Serverless Framework configuration
├── package.json # Project dependencies and scripts
└── README.md # Project documentation