cdk-appsync-typescript-resolver
TypeScript icon, indicating that this package has built-in type declarations

0.0.25 • Public • Published

cdk-appsync-typescript-resolver

npm (scoped) Codacy Badge GitHub Workflow Status (branch) GitHub release (latest SemVer) License PRs Welcome Maintained Gitpod ready-to-code

Constructs to transpile and bundle Typescript to valid AWS Appsync's JS resolvers

View on Construct Hub

✨ Constructs

🚀 Usage

  • 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,
});
  • TSExpressPipelineResolver
import { TSExpressPipelineResolver } from 'cdk-appsync-typescript-resolver'
...
const resolver = new TSExpressPipelineResolver(testStack, "DemoResolver", {
    api: new appsync.GraphqlApi(...),
    typeName: "Query",
    fieldName: "hello",
    tsFunction: new AppsyncTypescriptFunction(...),
});

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

References

JavaScript resolvers overview

Bundling, TypeScript, and source maps

GraphQL Code Generator

Package Sidebar

Install

npm i cdk-appsync-typescript-resolver

Weekly Downloads

257

Version

0.0.25

License

Apache-2.0

Unpacked Size

9.93 MB

Total Files

28

Last publish

Collaborators

  • sudokar