Slide 85
Slide 85 text
AppSync with CDK
import * as cdk from '@aws-cdk/core';
import * as appsync from '@aws-cdk/aws-appsync';
export class AppsyncCdkAppStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// Creates the AppSync API
const api = new appsync.GraphqlApi(this, 'Api', {
name: 'my-awesome-app',
schema: appsync.Schema.fromAsset('graphql/schema.graphql'),
});
// Prints out the AppSync GraphQL endpoint to the terminal
new cdk.CfnOutput(this, "GraphQLAPIURL", {
value: api.graphqlUrl
});
}
}