serve library

Provides the features needed to execute Cloud Functions.

Typically, this library is imported in bin/server.dart or similar.

While it's possible to use this library from hand-written code, you should use package:functions_framework_builder to generate server code instead.

Classes

FunctionTarget
JsonFunctionTarget<RequestType, ResponseType>
JsonWithContextFunctionTarget<RequestType, ResponseType>

Functions

serve(List<String> args, FunctionTarget? nameToFunctionTarget(String)) Future<void>
If there is an invalid configuration, exitCode will be set to a non-zero value and the returned Future will completes quickly.

Exceptions / Errors

BadRequestException
When thrown in a Handler, configured with badRequestMiddleware or similar, causes a response with statusCode to be returned.