Functions Framework for Dart
This is a community-supported project, meaning there is no official level of support. The code is not covered by any SLA or deprecation policy.
|Functions Framework||Unit Tests||Lint Test||Conformance Tests|
An open source FaaS (Function as a Service) framework for writing portable Dart functions, brought to you by the Google Dart and Cloud Functions teams.
The Functions Framework lets you write lightweight functions that run in many different environments, including:
- Your local development machine
- Google Cloud Run - see cloud run quickstart
- Google App Engine
- Knative-based environments
Google Cloud Functions does not currently provide an officially supported Dart language runtime, but we're working to make running on Google Cloud Run as seamless and symmetric an experience as possible for your Dart Functions Framework projects.
The framework allows you to go from:
import 'package:functions_framework/functions_framework.dart'; import 'package:shelf/shelf.dart'; @CloudFunction() Response function(Request request) => Response.ok('Hello, World!');
curl https://<your-app-url> # Output: Hello, World!
All without needing to worry about writing an HTTP server or request handling logic.
See more demos under the examples directory.
- Invoke a function in response to a request
- Automatically unmarshal events conforming to the CloudEvents spec
- Portable between serverless platforms
From the Dart quickstart on your local machine:
$ cd examples/hello $ docker build -t app . ... $ docker run -it -p 8080:8080 --name demo --rm app Listening on :8080
In another terminal:
$ curl localhost:8080 Hello, World!
See more quickstarts.
CONTRIBUTING.md for details on how to contribute to
this project, including how to build and test your changes as well as how to
properly format your code.
Apache 2.0; see
LICENSE for details.