cdk-appsync-typescript-resolver
v0.0.28
Published
AWS CDK construct to build AppSync JS resolvers using Typescript
Downloads
312
Maintainers
Readme
cdk-appsync-typescript-resolver
Constructs to transpile and bundle Typescript to valid AWS Appsync's JS resolvers
✨ Constructs
- TypescriptUnitResolver - Unit resolver with typescript source
- AppsyncTypescriptFunction - Appsync function with typescript source
🚀 Usage
- TypescriptUnitResolver
import { TypescriptUnitResolver } from 'cdk-appsync-typescript-resolver'
const resolver = new TypescriptUnitResolver(stack, "DemoResolver", {
api: new appsync.GraphqlApi(...),
typeName: "Query",
fieldName: "hello",
path: path.join(__dirname, "path", "to", "file.ts"),
sourceMap: true,
});
- AppsyncTypescriptFunction
import { AppsyncTypescriptFunction } from 'cdk-appsync-typescript-resolver'
...
const appsyncFunction = new AppsyncTypescriptFunction(stack, "TSDemoFunction", {
name: "TSDemoFunction",
api: new appsync.GraphqlApi(...),
path: path.join(__dirname, "path", "to", "file.ts"),
dataSource: new appsync.DynamoDbDataSource(...),
sourceMap: true,
});
Tip: Use GraphQL Code Generator to generate Typescript types from GraphQL schema(s) to use in resolvers
Checkout the demo project for examples cdk-appsync-typescript-resolver-demo