This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const api = new GraphqlApi(this, 'cdk-chat-app-api', { | |
name: "cdk-chat-app", | |
logConfig: { | |
fieldLogLevel: FieldLogLevel.ALL, | |
}, | |
schema: Schema.fromAsset('graphql/schema.graphql'), | |
authorizationConfig: { | |
defaultAuthorization: { | |
authorizationType: AuthorizationType.USER_POOL, | |
userPoolConfig: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const messageTable = new Table(this, 'CDKMessageTable', { | |
billingMode: BillingMode.PAY_PER_REQUEST, | |
partitionKey: { | |
name: 'id', | |
type: AttributeType.STRING, | |
}, | |
}); | |
const roomTable = new Table(this, 'CDKRoomTable', { | |
billingMode: BillingMode.PAY_PER_REQUEST, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const userPool = new UserPool(this, 'chat-app-user-pool', { | |
selfSignUpEnabled: true, | |
accountRecovery: AccountRecovery.PHONE_AND_EMAIL, | |
userVerification: { | |
emailStyle: VerificationEmailStyle.CODE | |
}, | |
autoVerify: { | |
email: true | |
}, | |
standardAttributes: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as cdk from '@aws-cdk/core'; | |
import { UserPool, VerificationEmailStyle, UserPoolClient, AccountRecovery } from '@aws-cdk/aws-cognito'; | |
import { GraphqlApi, AuthorizationType, FieldLogLevel, MappingTemplate, Schema } from '@aws-cdk/aws-appsync'; | |
import { AttributeType, BillingMode, Table } from '@aws-cdk/aws-dynamodb'; | |
import { Role, ServicePrincipal, Effect, PolicyStatement } from '@aws-cdk/aws-iam'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as cdk from '@aws-cdk/core'; | |
import { UserPool, VerificationEmailStyle, UserPoolClient, AccountRecovery } from '@aws-cdk/aws-cognito'; | |
import { GraphQLApi, AuthorizationType, FieldLogLevel, MappingTemplate, SchemaDefinition } from '@aws-cdk/aws-appsync'; | |
import { AttributeType, BillingMode, Table } from '@aws-cdk/aws-dynamodb'; | |
import { Role, ServicePrincipal, Effect, PolicyStatement } from '@aws-cdk/aws-iam'; | |
export class CdkChatStack extends cdk.Stack { | |
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Message { | |
id: ID! | |
content: String! | |
owner: String | |
createdAt: String | |
roomId: ID | |
} | |
type Room { | |
id: ID! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as cdk from '@aws-cdk/core'; | |
import { CfnApiKey, PrimaryKey, Values, GraphQLApi, MappingTemplate, FieldLogLevel, AttributeValues } from '@aws-cdk/aws-appsync' | |
import { AttributeType, BillingMode, Table } from '@aws-cdk/aws-dynamodb'; | |
import * as lambda from '@aws-cdk/aws-lambda' | |
import { join } from 'path'; | |
export class AppsyncCdkStack extends cdk.Stack { | |
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import ReactPlayer from 'react-player' | |
import { HashRouter, Link, Switch, Route } from 'react-router-dom' | |
import AuthComponent from './AuthComponent' | |
import { Auth, API } from 'aws-amplify' | |
import { createComment as CreateComment } from './graphql/mutations' | |
import { listComments as ListComments } from './graphql/queries' | |
import { onCreateComment as OnCreateComment } from './graphql/subscriptions' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sharp = require("sharp"); | |
const aws = require("aws-sdk"); | |
const s3 = new aws.S3(); | |
exports.handler = async function(event, context) { | |
if (event.Records[0].eventName === "ObjectRemoved:Delete") { | |
return; | |
} | |
const BUCKET = event.Records[0].s3.bucket.name; | |
const KEY = event.Records[0].s3.object.key; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Customer @model(subscriptions: null) | |
@auth(rules: [ | |
{ allow: owner }, | |
{ allow: groups, groups: ["Admin"] } | |
]) { | |
id: ID! | |
name: String! | |
email: String! | |
address: String | |
orders: [Order] @connection(keyName: "byCustomerId", fields: ["id"]) |