Snap

f
Image of @focusotter
@focusotter
frontend.ts
import {API} from 'aws-amplify'

API.graphql({query: ListUsers}
cdkStack.ts
const api = new GraphqlApi(this, 'User API', {
  name: 'User API',
  schema: Schema.fromAsset(
    path.join(__dirname, 'schema.graphql')
  ),
  authorizationConfig: {
    defaultAuthorization: {
      authorizationType: AuthorizationType.API_KEY,
    },
  },
})
schema.graphql
type Query {
  listUsers(
    limit: Int, 
    nextToken: String): UserConnection
}

type User {
  userId: ID!
  firstname: String!
  lastname: String!
  picture: AWSURL!
}

type UserConnection {
  items: [User!]
  nextToken: String
}
graphql logo

🤝🏽

powered byLogosnappify