edge_runtime 0.0.1+1 copy "edge_runtime: ^0.0.1+1" to clipboard
edge_runtime: ^0.0.1+1 copied to clipboard

Runtime APIs for running Dart on Edge function environments.

example/lib/main.dart

import 'package:edge_runtime/edge_runtime.dart';

void main() {
  // Setup the runtime environment.
  setupRuntime();

  // Register a fetch event listener.
  addFetchEventListener((event) {
    final request = event.request;

    // Ignore browser favicon requests.
    if (request.url.toString().contains('favicon')) {
      event.respondWith(Response(''));
    }

    event.respondWith(fetchHandler(request));
  });
}

/// A fetch event handler.
Future<Response> fetchHandler(Request request) async {
  return Response('Hello, world!!', status: 200);
}
0
likes
0
pub points
6%
popularity

Publisher

verified publisherinvertase.io

Runtime APIs for running Dart on Edge function environments.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

freezed_annotation, js, js_bindings

More

Packages that depend on edge_runtime