Last active
November 1, 2022 09:44
-
-
Save cal0610/e60b8530eeb9caad1e7e649e2c974f81 to your computer and use it in GitHub Desktop.
add rest api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as cdk from 'aws-cdk-lib'; | |
import { Construct } from 'constructs'; | |
import * as apigateway from 'aws-cdk-lib/aws-apigateway'; | |
export class MyStack extends cdk.Stack { | |
constructor(scope: Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); | |
const api = new apigateway.RestApi(this, 'test-api', { | |
description: 'Test project', | |
deployOptions: { | |
stageName: 'dev', | |
}, | |
defaultCorsPreflightOptions: { | |
allowOrigins: apigateway.Cors.ALL_ORIGINS, // replace with calling origin | |
allowMethods: apigateway.Cors.ALL_METHODS | |
}, | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment