New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cdk-http-openapi

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cdk-http-openapi

CDK Construct that lets you build AWS Api Gateway Http Api, backed by Lambdas, based on a OpenAPI spec file.

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

cdk-http-openapi

CDK Construct that lets you build AWS Api Gateway Http Api, backed by Lambdas, based on a OpenAPI spec file.

Features

[] Deploy Api Gateway Http Api based on a OpenAPI spec file. [] Each API Route will be backed by 1 NodeJS lambda. [] Configure CORS for your API. [] Add custom domain (eg: https://my-awesome-api.my-domain.com) to your API. [] Enable custom authorizers to Http Api Lambda integrations. [] Customize your lambdas's memory, timeouts, log retention, env variables and other stuff.

Setup

Add latest package to your project with npm/yarn

npm i --save cdk-http-openapi
yarn add -D cdk-http-openapi

Start using cdk constructs in your infrastructure definition
Examples

import { HttpOpenApi } from 'cdk-http-openapi'

// ... in your stack definition
const api = new HttpOpenApi(this, 'MyApi', {
    serviceName: 'my-service',
    openApiSpec: './openapi.yml',
    lambdasSourcePath: './dist/src' // optional. It defaults to './.build/src'
    integrations: [
        {
            operationId: 'getEntity', // for each operation you define in your OpenAPI spec
            handler: 'api.getEntity', // you can register a lambda handler to handle your http request
        },
        {
            operationId: 'storeEntity',
            handler: 'api.storeEntity',
            timeoutSeconds: 5,
            memorySize: 512,
            env: { 
                DB_HOST: '...',
                DB_USERNAME: '...',
                DB_PASSWORD: '...'
            },
        }
    ]
});

const domainName = 'my-awesome-api.cool.io';
const certificateArn = `arn:aws:acm:${AWS_REGION}:${AWS_ACCOUNT}:certificate/${CERTIFICATE_ID}`;
const hostedZone = 'cool.io';

api.enableCustomDomain({domainName, certificateArn, hostedZone});

Keywords

cdk

FAQs

Package last updated on 06 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts