Skip to content

This project was created to run GraphQL on a serverless framework using AWS Lambda

Notifications You must be signed in to change notification settings

akash-kansara/graphql-typescript-aws-lambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL Typescript (AWS Lambda)

This project was created to run GraphQL on a serverless framework using AWS Lambda.

Application Business logic

This app has a single GraphQL query (serverTime) which returns server time in long format.

Project structure

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

To start server, follow these steps

Step 1: Install NodeJS & NPM

NodeJS & NPM

Step 2: Get project

Clone this repository and go to this project's root location

Step 3: Add global dependencies

npm i -g serverless

Step 4: Add local dependencies

npm i -D

Step 5: Run in dev environment

npm run start:dev

Step 6: Check API

Open browser and go to http://localhost:3000/playground

Step 7: Configure AWS credentials

Configuration guide

Step 8: Build for production

npm run build

Step 9: Deploy in AWS

npm run deploy

Step 10: Check API in AWS

curl -X POST -H "Content-Type: application/json" -d "{ \"query\": \"{ serverTime }\" }" "GRAPHQL_FUNCTION_URL"

About

This project was created to run GraphQL on a serverless framework using AWS Lambda

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published