Giter VIP home page Giter VIP logo

grpc-js-typescript's People

Contributors

badsyntax avatar dependabot-preview[bot] avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

grpc-js-typescript's Issues

When importing dto files, there is no way to export

  1. create example-dto.proto file
syntax = "proto3";

package v1;

message ServerMessage {
  string server_message = 1;
}

message ClientMessage {
  string client_message = 1;
}
  1. create example.proto file
syntax = "proto3";

import "proto/example-dto.proto";

package example_package;

service Example {
  rpc unaryCall(v1.ClientMessage) returns (v1.ServerMessage) {}
}
  1. run ./compile-proto.sh,

  2. check example_pb.js file conent

/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 * @public
 */
// GENERATED CODE -- DO NOT EDIT!

var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();

var example$dto_pb = require('./example-dto_pb.js');
goog.object.extend(proto, example$dto_pb);

ServerMessage and ClientMessage method is not exported by example_pb.js

Update example for grpc-tools v1.9

Per grpc/grpc-node#1417, the it looks like the sed commands should no longer be needed in the gen script... but I can't seem to figure out what argument is supposed to go where to make this work. Can you update this repo to provide such an example?

And by the way, THANK YOU for putting this together.

How to implement the server

Thank you very much for your example, but I'm not sure how to implement the actual logic and a server?

I guess it should look something like that, but I struggle how to actually implement the interface?

// src/index.ts
import * as grpc from '@grpc/grpc-js'
import * as services from './proto/echo_service_grpc_pb'

class EchoService implements services.IEchoServiceService {
    // ?
}

var server = new grpc.Server();
server.addService(services.EchoServiceService, new EchoService());
server.bindAsync("127.0.0.1:50051", grpc.ServerCredentials.createInsecure(), (err, port) => {
    if (!err) server.start();
});

Or is there is something missing? For example in https://github.com/agreatfool/grpc_tools_node_protoc_ts/blob/b7b5e97349d3f9463214f4cc65e2ec2c9e44320a/examples/src/grpcjs/proto/book_grpc_pb.d.ts#L57-L62 there is also additional interface IBookServiceServer defined which I guess should be used as implementation interface for servers but here it's missing?

Add examples of how to test gRPC methods

I'm not sure if this should be in 'issue' so feel free to close. I'm hugely thankful for this repo, as I was struggling to find a working example of a simple grpc server and client.

Having put together a simple grpc repo myself, I am now struggling to come up with a way to test this setup. I'd like to be able to get the server running, then invoke the client and assert against the response on the client side.

Any resources on how I can do this please?

Can't run compile-proto.sh

Hello, thanks for the effort you've been giving to this project. Its been really helpful for me.

But I couldn't generate proto files from the script you've written in windows even though bash is installed. Can you help me with that?

A way to bundle TS client stubs as an npm package

Hello and thanks for all the examples here on how to use gRPC with TypeScript. This is not an issue and actually a question.
I was wondering if there is a way to package the generated TS client stubs as an npm package (without using Rollup or Webpack or the like) that can later used via an npm install.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.