Skip to content

yinlinchen/amplify-appsync-graphql

Repository files navigation

Amplify Appsync GraphQL

Prerequisite

  • Install Create React App CLI
     npm install -g create-react-app
    
  • Install the AWS Amplify CLI
     npm install -g @aws-amplify/cli
    

Custom resolvers workflow

  • Step1: Add custom type to the schema

    • Add custom Query, Mutation or Subscription type to your schema.
  • Step2: Create custom resolver template

    • Request and response template should be located in <project-root>/amplify/backend/api/<api-name>/resolvers folder.
    • Graphql Transformer follows <TypeName>.<FieldName>.<req/res>.vlt as convention to name the resolvers.
      • Request template: Query.myCustomQuery.req.vtl
      • Response template: Query.myCustomQuery.res.vtl
  • Step3: Add resolvers resource by creating a custom stack

    • By default, there is a file called CustomResources.json in <project-root>/amplify/backend/api/<api-name>/stacks directory of your API.
    • Example: CustomResource.json

Examples

  1. Basic models
  2. Enable basic search
  3. Fuzzy search
  4. Query for Interface type
  5. Search with AND/OR operations
  6. Multi-fields search
  7. Custom searchable input
  8. Query for Union type
  9. geolocation search capabilities

Launching the example app

amplifybutton

Docs