dart_cloud_function 0.1.0 copy "dart_cloud_function: ^0.1.0" to clipboard
dart_cloud_function: ^0.1.0 copied to clipboard

Dart Cloud Function package for serverless functions in Dart

example/dart_cloud_function_example.dart

import 'package:dart_cloud_function/dart_cloud_function.dart';

/// Example cloud function that echoes back the request details
///
/// This demonstrates the proper structure for a cloud function:
/// - Exactly one class extending CloudDartFunction
/// - Annotated with @cloudFunction
/// - No main() function
@cloudFunction
class EchoFunction extends CloudDartFunction {
  @override
  Future<CloudResponse> handle({
    required CloudRequest request,
    Map<String, String>? env,
  }) async {
    return CloudResponse.json({
      'message': 'Echo Function',
      'method': request.method,
      'path': request.path,
      'query': request.query,
      'body': request.body,
      'timestamp': DateTime.now().toIso8601String(),
    });
  }
}
0
likes
140
points
32
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dart Cloud Function package for serverless functions in Dart

Repository (GitHub)

License

unknown (license)

Dependencies

path

More

Packages that depend on dart_cloud_function