functions_framework 0.4.3 functions_framework: ^0.4.3 copied to clipboard
FaaS (Function as a service) framework for writing portable Dart functions
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.
Feel free to start a discussion to share thoughts or open issues for bugs and feature requests.
Functions Framework | Unit Tests | Lint Test | Conformance Tests |
---|---|---|---|
Dart |
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:
examples/hello/lib/functions.dart
import 'package:functions_framework/functions_framework.dart';
import 'package:shelf/shelf.dart';
@CloudFunction()
Response function(Request request) => Response.ok('Hello, World!');
To:
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.
Features #
- Invoke a function in response to a request
- Automatically unmarshal events conforming to the CloudEvents spec
- Portable between serverless platforms
Quickstart #
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 changes #
See 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.
Licensing #
Apache 2.0; see LICENSE
for details.