I’m trying to get started with Pulumi but struggling to find any samples that go beyond the most simple implementation.
I want to get a NestJS API connected to a GCP cloud function with Pulumi. In all the samples for the GCP cloud functions the request handling (and business logic) happens inside of the callback that Pulumi creates.
I want to decouple my callback logic from Pulumi so I can run it locally as well. Does anyone have an example of this?
I’m a beginner to backend development so sorry for the beginner question
05/04/2022, 10:06 PM
I don't know GCP well but it looks like the GCP CloudFunctions and AWS Lambdas are similarly related. They'll have a limited run time since they're meant for small tasks. Thus they probably won't be able to run NestJS, however, from the way the GCP API's are written, you could maybe integrate a Gateway API endpoint to a GCP CloudFunction.
Sorry I'm not much help because I don't really use GCP.
05/04/2022, 10:16 PM
hmm ok yeah maybe NestJS isn’t the best choice. I guess my question is more around how to separate the infrastructure (pulumi) code and the app code.
I have just seen there are 2 types of gcp function types : Function and HttpCallbackFunction.
With HttpCallbackFunction Pulumi provides a callback to handle the logic. With Function you can specify an entryPoint.
I’m wondering what the best one to use is and can I use HttpCallbackFunction and reference a Express app from another file