wulfmann / auto-cdk

Effortless APIs with CDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auto CDK

auto-cdk lets you generate an api gateway with lambda integrations based on the filesystem. It makes use of AWS CDK to generate cloudformation stacks, and Webpack for bundling and code-splitting.

Caveats

Currently this project only aims to build and package node/typescript-based integrations. It is on the roadmap to support more, but will not be available until a later version.

Quickstart

yarn add auto-cdk

Create an api directory and add a file to it that exports a function named handler:

$ mkdir api && touch api/index.ts
// api/index.ts

exports.handler = (event, ctx) => {
  return {
    statusCode: 200,
    body: 'hello world',
    headers: {
      'Content-Type': 'text/html'
    }
  }
}

Run:

$ yarn dev

You should now have webpack auto-compiling when your source changes, and a cdk stack that has been generated in cdk.out.

Bonus

If you install AWS sam-cli, you can run the api on localhost with the following:

$ sam local start-api cdk.out/*.template.json

View more examples here.

Features

  • Automatic CDK Stack Generation
  • Code-Splitting and Bundling with Webpack
  • Out of the box typescript support

Contributing

If you would like to make a contribution or learn more about running this project locally, please review the Contributing Documentation.

About

Effortless APIs with CDK


Languages

Language:TypeScript 96.2%Language:JavaScript 3.8%