-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added appsync api with userpool and web client
- Loading branch information
Showing
4 changed files
with
2,485 additions
and
105 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,50 @@ | ||
import { Stack, StackProps } from 'aws-cdk-lib'; | ||
//import * as appsync from '@aws-cdk/aws-appsync'; | ||
import * as appsync from '@aws-cdk/aws-appsync-alpha'; | ||
|
||
import { Stack, StackProps, CfnOutput } from 'aws-cdk-lib'; | ||
import { Construct } from 'constructs'; | ||
// import * as sqs from 'aws-cdk-lib/aws-sqs'; | ||
import { aws_cognito as cognito } from 'aws-cdk-lib'; | ||
|
||
|
||
export class CdkTypescriptStack extends Stack { | ||
constructor(scope: Construct, id: string, props?: StackProps) { | ||
super(scope, id, props); | ||
|
||
// The code that defines your stack goes here | ||
const userPool = new cognito.UserPool(this, 'CdkAuth', { | ||
userPoolName: 'CdkAuth', | ||
selfSignUpEnabled: true, | ||
signInAliases: { | ||
email: true | ||
} | ||
}); | ||
|
||
const webClient = userPool.addClient('web', { | ||
userPoolClientName: 'web', | ||
authFlows: { | ||
userPassword: true, | ||
userSrp: true | ||
} | ||
}); | ||
|
||
const api = new appsync.GraphqlApi(this, 'ContractsApi', { | ||
name: 'contracts-api', | ||
schema: appsync.Schema.fromAsset('schema.api.graphql'), | ||
authorizationConfig: { | ||
defaultAuthorization: { | ||
authorizationType: appsync.AuthorizationType.USER_POOL, | ||
userPoolConfig: { | ||
userPool | ||
} | ||
}, | ||
}, | ||
|
||
logConfig: { | ||
fieldLogLevel: appsync.FieldLogLevel.ALL | ||
}, | ||
xrayEnabled: true, | ||
}); | ||
|
||
// example resource | ||
// const queue = new sqs.Queue(this, 'CdkTypescriptQueue', { | ||
// visibilityTimeout: cdk.Duration.seconds(300) | ||
// }); | ||
new CfnOutput(this, 'GraphQL_URL', { value: api.graphqlUrl }); | ||
|
||
} | ||
} | ||
}; |
Oops, something went wrong.