Serverless Functions in Any Language
Google Cloud Functions is a scalable pay-as-you-go functions as a service (FaaS) to run your code with zero server management. In the last year, the serverless team has open sourced 7 function frameworks (libraries) that power Cloud Functions in 7 languages.
Let’s give a brief overview of them:
Node 🔗
npm i @google-cloud/functions-framework
- Uses Express’
(request, response)
pattern - Supports Promises, great for non-blocking I/O
Python 🔗
pip install functions-framework
- Uses Flask, Gunicorn as an HTTP server
Go 🔗
import "github.com/GoogleCloudPlatform/functions-framework-go/funcframework"
- Uses Go’s native HTTP package
- Support CloudEvents via the CloudEvent SDK
Java 🔗
mvn install -DgroupId="com.google.cloud.functions" -DartifactId="functions-framework-api" -Dversion="1.0.2"
- Uses Java and Maven
- Supports other JVM languages such as Kotlin, Groovy, and Scala
Ruby 🔗
gem install functions_framework
- Uses standard Ruby Rack interface
- Built-in helpers for text fixtures
.NET Core (private preview) 🔗
dotnet new -i Google.Cloud.Functions.Templates::1.0.0-beta02
- Built on ASP.NET Core w/ dependency injection
- Templates for getting started and testing
PHP 7.4 (private preview) 🔗
composer require google/cloud-functions-framework
- Usable with PHP’s built-in server
- Supports
symfony/http-foundation
—
These frameworks are built into Google Cloud Functions, but are perfectly usable on Cloud Run, testing with localhost, or use in other environments.
Learn More
Thanks for reading! These frameworks are open source and accept issues and contributions. Feedback and comments on issues are welcome too.
People that liked this post might also like these other resources: