functions_framework 0.2.0
functions_framework: ^0.2.0 copied to clipboard
FaaS (Function as a service) framework for writing portable Dart functions
Functions Framework for Dart #
DISCLAIMER: this is not ready for production, doen't support cloudevents yet, and doesn't have tests yet for Functions Framework Conformance.
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:
- Google Cloud Functions
- Your local development machine
- Knative-based environments
- Google App Engine
- Google Cloud Run
The framework allows you to go from:
import 'package:functions_framework/functions_framework.dart';
import 'package:shelf/shelf.dart';
@CloudFunction()
Response handleGet(Request request) => Response.ok('Hello, World!');
To:
curl http://my-url
# Output: Hello, World!
All without needing to worry about writing an HTTP server or request handling logic.
Features #
- Build your Function in the same container environment used by Cloud Functions using buildpacks.
- Invoke a function in response to a request
- Automatically unmarshal events conforming to the CloudEvents spec
- Portable between serverless platforms
Quickstart: Hello, World on your local machine #
$ docker build -t app .
...
$ docker run -it -p 8080:8080 --name demo app
App listening on :8080
In another terminal...
$ curl localhost:8080
Hello, World!
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 #
BSD 3-Clause License. See LICENSE
for details.