GraphQL @connection:
What is Serverless Architecture? What are its Pros and Cons?
AWS Amplify
- AWS Amplify - set of tools and services that can be used together or on their own, to help front-end web and mobile developers build scalable full stack applications, powered by AWS.
- Benefits - configure backends fast, seamlessly connect frontends, deploy in a few clicks, and easily manage content.
- Features and tools - develop, deliver, and manage
- Develop - configure backend, connect your app, and integrate UI compenets.
- Deliver - connect repository, configure buildsettings, and deploy your app.
- Manage - invite team members, manage users, and manage content.
- Use cases - onboarding flows, real-time collaboration, AI/ML, and targeted campaigns.
GraphQL Add relationships between types
-
@connection directive - enables you to specify relationships between @model types.
- Definition : directive @connection(keyName: String, fields: [String!]) on FIELD_DEFINITION
- Usage - Relationships between types are specified by annotating fields on an @model object type with the @connection directive.
- fields argument can be provided and indicates which fields can be queried by to get connected objects.
- keyName argument can optionally be used to specify the name of secondary index that should be queried from the other type in the relationship. The fields argument should be provided to indicate which field(s) will be used to get connected objects, and if keyName is not provided, then @connection queries the target table’s primary index.
- Can also define the field you would like to use for the connection by populating the first argument to the fields array and matching it to a field on the type.
- Has One @connection can only reference the primary index of a model.
-
Has many - one-to-many connection needs an @key that allows comments to be queried by the postID and the connection uses this key to get all comments whose postID is the id of the post was called on.
- Many-to-many connections - an implement many to many using two 1-M @connections, an @key, and a joining @model.