cdktf-integration-serverless-example icon indicating copy to clipboard operation
cdktf-integration-serverless-example copied to clipboard

API Local Development

Open michaelmerrill opened this issue 4 years ago • 1 comments

In reading the code, I didn't see a way to run the frontend and backend api locally. I see the frontend is defaulting to localhost:4000, but I'm wondering if there is a way develop the lambdas locally while building out the frontend and without deploying the backend stack?

michaelmerrill avatar Feb 15 '22 20:02 michaelmerrill

Hi @michaelmerrill 👋 That's right, currently there is none.

While there probably are ways to make that work for AWS lambda (e.g. using localstack), it is close to impossible to properly simulate everything locally. Especially if we put other (non-AWS) cloud resources into the mix (e.g. Cloudflare Workers) which would require other means of simulating it locally. This is why the experimental cdktf watch command exists. It aims to allow faster iterations when working with serverless.

However in regards to this example repo which only uses AWS resources: localstack has docs of how to use Terraform to provision locally into localstack, which is something that would also work with the CDK for Terraform. Experimenting with this could yield results with low effort.

ansgarm avatar Feb 16 '22 08:02 ansgarm