Setup of An Application Using AWS Appsync & Sending Request Using Postman,Graphql Playground
Today I was stuck finding a solution on a very specific problem: to find a way that to design a customized schema in aws appsync and integrated through angular application to send a single request.
As you probably know that Appsync helps to fully managed GraphQL service with real-time data synchronization and offline programming features.Using this we can design our schema as per requirements and write queries to run that schema.Using these AWS services Let’s find a solution…!!!
Please refer this link for your google maps reference.
Custom Google Maps In Angular Application
Today I was stuck finding a solution on a very specific problem: to find a way that to access Google maps in my…
Please refer this link for your graphql reference.
- Login to Aws management console and at Services click on AWS AppSync.
- Create an API.
- Enter your API name and create.
- Click on Schema.
- Design your schema as per your requirement and Save.
- Now create a Resource.
- Define your new resource type or else we can use existing one.
- Enter your DynamoDB table name and primary key. If you enable additional Indexes it automatically generates graphql schema as per your requirement.
- Click on Create.
- It starts updating the schema.
- In mutations, select your mutation and click on that table name.
- Select your sample template as per your requirement and modify code.
- Save the resolver after modifying request mapping template.
- Again click on other mutation and select mapping template.
- Select request mapping template and modify query and save resolver.
- Also at Query field, click on the table name.
- If you want to list items to be displayed select List items.
- Automatically, table is created and with your resource name.
- This is the DynamoDB table you created.
- Click on Queries, and write queries to insert data,delete and to see list of items in DB.
- Follow the above reference link, using cloud formation template , Cognito is created. Create a user from lambda for authentication.
- We can get this app client ID from Cognito.
- Go to Settings, and enter your cognito details here.
- Click on Login with User Pools.
- Enter your ClientId, Username, Password that you have in Cognito and Login.
- Click on that particular operation you want to run.
- The query runs, here is the output.
- And the data will be inserted in DynamoDB which you created.
- We can also test it using graphql playground.Enter your graphql URL,Headers,Query variables.
- Using graphql playground we can also insert data to DB.
- If you want to delete the data,run this delete query.
- Here,delete query runs and the data in the record is deleted.
- Here, the data is deleted from DynamoDB.
- To see the list of data present in DynamoDb. Here, the list of items present in DB is displayed in json.
- The list of items present in DynamoDB will be displayed here in Json Format.
- When you run your angular application,at Network filed there is a request from graphql,click on request payload copy it.
- Go to Postman and enter your graphql endpoint URL and paste the above request payload here and test it by generating a token from lambda.
- If you run your angular application the marker is displayed over that particular location.
Ok, that’s it. I hope you found this case useful! See you next time.