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

Improved main README and fixed npm install issues #14

Merged
merged 1 commit into from
Nov 6, 2017

Conversation

jonathan-casarrubias
Copy link
Contributor

Improved main README and fixed npm install issues

@jonathan-casarrubias jonathan-casarrubias force-pushed the jcasarrubias/built_in_grpc_types branch from 6315b54 to 49ac145 Compare November 3, 2017 22:12
README.md Outdated
## Overview
TODO.
The `@loopback/grpc` component enables LoopBack 4 as a Grpc Server. Also it provides with a @grpc decorator to define your RPC Method implementations from your Application Controllers.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a url for gRPC. Change @grpc to @grpc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

```js
import {grpc} from '@loopback/grpc';
// You create the following types according your own proto.file
import {Greeter, HelloRequest, HelloReply} from './types';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these generated gRPC interfaces/classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look this awesome tool that @VMois found https://geotho.github.io/protobuf-to-typescript/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does convert great the messages but it looks service and rpc methods are not so good, but yeah the idea is to autogenerate those from the proto file

package greeterpackage;
syntax = "proto3";
 
service Greeter {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloReply {
  string message = 1;
}

export class MyGreeter implements Greeter {
// Tell LoopBack that this is a Service RPC implementation
@grpc()
SayHello(request: HelloRequest): HelloReply {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method name is typically camelCase.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to support separate parameters, such as sayHello(prefix: string, name: string)? The HelloRequest will have prefix and name properties. Maybe ES6 parameter destructuring is good enough.

Copy link
Contributor Author

@jonathan-casarrubias jonathan-casarrubias Nov 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you are right I took it from the grpc examples but these are language agnostic, in this case the convention is camelCase so I'll change that. 👍

About the parameters I would rather not to do it as default. You know, I like the idea of passing an entire dependency instead of lots of parameters, also is the way you actually define RPC methods so is more consistent.

Do you see any benefit on passing each of the parameters instead of the entire object?

It could be a configurable option though, I would like the entire object to be default, but an option to pass the args as params should be easy to implement anyway.

@raymondfeng
Copy link
Contributor

Some nitpicks. LGTM.

@jonathan-casarrubias jonathan-casarrubias force-pushed the jcasarrubias/built_in_grpc_types branch from 49ac145 to a032fab Compare November 6, 2017 16:21
@jonathan-casarrubias jonathan-casarrubias merged commit ee87e64 into master Nov 6, 2017
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

Successfully merging this pull request may close these issues.

npm install failed after starter setup merge Update main README
3 participants