This project was created to run GraphQL on a serverless framework using AWS Lambda.
This app has a single GraphQL query (serverTime) which returns server time in long format.
Folder Path | Description |
---|---|
dist/ | Build folder |
src/type.ts | GraphQL type definition |
src/resolver.ts | GraphQL resolver definition |
src/schema.ts | GraphQL schema definition |
src/index.ts | GraphQL config and Lambda function |
package.json | Project dependencies |
tsconfig.json | Production transpiling configuration |
serverless.yml | Serveless configuration |
Clone this repository and go to this project's root location
npm i -g serverless
npm i -D
npm run start:dev
Open browser and go to https://localhost:3000/playground
npm run build
npm run deploy
curl -X POST -H "Content-Type: application/json" -d "{ \"query\": \"{ serverTime }\" }" "GRAPHQL_FUNCTION_URL"