Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required Decorators Analysis #6

Closed
jonathan-casarrubias opened this issue Oct 30, 2017 · 2 comments
Closed

Required Decorators Analysis #6

jonathan-casarrubias opened this issue Oct 30, 2017 · 2 comments
Assignees

Comments

@jonathan-casarrubias
Copy link
Contributor

jonathan-casarrubias commented Oct 30, 2017

API-first (top-down) vs. code-first (bottom-up) approach, how to provide protobuf metadata - think of @api and @get decorators for REST

loopbackio/loopback-next#582

As developer, I want be able to use TypeScript decorators as an option to add proto services.

In order to follow a naming convention from the official gRPC module, I propose to use addProtoService name for this decorator, so it is easier for people coming to LB4 and that already knows gRPC to ramp up

@jonathan-casarrubias jonathan-casarrubias self-assigned this Oct 30, 2017
@jonathan-casarrubias jonathan-casarrubias changed the title Implement addProtoService Decorator Required Decorators Analysis Oct 30, 2017
@jonathan-casarrubias
Copy link
Contributor Author

If we want to support microservices oriented architecture... This might be a good implementation

@gRPCService({ host: ‘’, port: 9000, proto: '' })
class MyController {
    @rpc()
    sayHello(HelloRequest): HelloResponse {}
}

@jonathan-casarrubias
Copy link
Contributor Author

jonathan-casarrubias commented Nov 3, 2017

Discussed and Landed on PR #8

/**
* Setup gRPC MicroService
**/
class Greeter implements GreeterInterface {
  @grpc()
  SayHello(request: HelloRequest): HelloReply {
    return {message: `hello ${request.name}`};
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant