https://github.com/wulfmann/auto-cdk
  
  
    Effortless APIs with CDK 
    https://github.com/wulfmann/auto-cdk
  
api api-gateway aws aws-lambda cdk generator webpack
        Last synced: 6 months ago 
        JSON representation
    
Effortless APIs with CDK
- Host: GitHub
- URL: https://github.com/wulfmann/auto-cdk
- Owner: wulfmann
- Created: 2020-06-02T23:48:32.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T18:46:49.000Z (almost 3 years ago)
- Last Synced: 2025-03-30T09:41:19.098Z (7 months ago)
- Topics: api, api-gateway, aws, aws-lambda, cdk, generator, webpack
- Language: TypeScript
- Homepage:
- Size: 534 KB
- Stars: 24
- Watchers: 2
- Forks: 2
- Open Issues: 42
- 
            Metadata Files:
            - Readme: README.md
- Contributing: CONTRIBUTING.md
 
Awesome Lists containing this project
- awesome-cdk - auto-cdk - Automatically generate api-gateway/lambda integrations with the filesystem (beta). (Construct Libraries / APIs)
README
          # Auto CDK
`auto-cdk` lets you generate an api gateway with lambda integrations based on the filesystem. It makes use of [AWS CDK](https://aws.amazon.com/cdk/) to generate cloudformation stacks, and [Webpack](https://webpack.js.org) 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
```bash
yarn add auto-cdk
```
Create an `api` directory and add a file to it that exports a function named `handler`:
```bash
$ mkdir api && touch api/index.ts
```
```js
// api/index.ts
exports.handler = (event, ctx) => {
  return {
    statusCode: 200,
    body: 'hello world',
    headers: {
      'Content-Type': 'text/html'
    }
  }
}
```
Run:
```bash
$ 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](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html), you can run the api on localhost with the following:
```bash
$ sam local start-api cdk.out/*.template.json
```
View more examples [here](/docs/examples).
## 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](/CONTRIBUTING.md).