Skip to content

codemonger-io/cdk-cors-utils

Repository files navigation

English / 日本語

CDK CORS Utilities

Provides utilities to configure CORS for Amazon API Gateway (API Gateway) with AWS Cloud Development Kit (CDK).

For whom is this library?

This library would help you if you feel tiresome of repeating CORS settings for API Gateway with CDK.

Background

When I describe a REST API with API Gateway, I often write a couple of utility functions to deal with CORS. These functions are quite simple though, I no longer want to prepare them everytime I start a new project.

How to install

Please add this repository to your Node dependencies.

npm install https://github.com/codemonger-io/cdk-cors-utils.git#v0.3.0

The installed module will be available as cdk2-cors-utils like the following,

import { makeIntegrationResponsesAllowCors } from 'cdk2-cors-utils';

This library is designed for CDK v2.x, and does not work with CDK v1.x.

APIs

Please refer to api-docs/markdown/index.md.

Examples

TBD

Development

Transpiling TypeScript files

build script transplies TypeScript files in the src folder.

npm run build

You will find transpiled JavaScript (*.js) and type declaration (*.d.ts) files created in a folder dist.

Generating API documentation

doc script generates the API documentation.

npm run doc

You will find markdown files updated in the folder api-docs/markdown. Documentation is generated by API Extractor and API Documenter.