Skip to main content

diana_grpc 0.15.1 copy "diana_grpc: ^0.15.1" to clipboard
diana_grpc: ^0.15.1 copied to clipboard

gRPC support for the Diana backend framework: dependency-injected protoc-generated services with Diana lifecycle integration.

example/README.md

diana_grpc example #

dependencies:
  diana: ^0.15.1
  diana_grpc: ^0.15.1
  grpc: ^5.0.0
  protobuf: ^6.0.0

Generate Dart code from your .proto, then extend the generated service base. It is a regular singleton injectable — constructor injection, @Value and lifecycle hooks all apply — and the generated DianaApp serves it on its own port next to your HTTP controllers:

import 'package:diana/diana.dart';
import 'package:grpc/grpc.dart' show ServiceCall;

import '../src/generated/greeter.pbgrpc.dart';

@GrpcService()
class GreeterService extends GreeterServiceBase {
  final String greetingPrefix;

  GreeterService(
      @Value('app.greeting', defaultValue: 'Hello') this.greetingPrefix);

  @override
  Future<HelloReply> sayHello(ServiceCall call, HelloRequest request) async =>
      HelloReply()..message = '$greetingPrefix, ${request.name}!';
}

A complete app serving gRPC and HTTP side by side is in examples/greeter_grpc. See the gRPC guide.

0
likes
160
points
134
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

gRPC support for the Diana backend framework: dependency-injected protoc-generated services with Diana lifecycle integration.

Repository (GitHub)
View/report issues

Topics

#grpc #rpc #server

License

MIT (license)

Dependencies

diana, grpc

More

Packages that depend on diana_grpc