1.1.4 • Published 5 years ago

grpc-server-ts v1.1.4

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

NPM version

Installation

npm install grpc-server-ts --save

protobuf

hello.proto

syntax = "proto3";

option java_multiple_files = true;
option java_package = "io.grpc.service.test";
option objc_class_prefix ="RTG";

package hello;

service Hello {
  rpc say(stream Empty) returns (stream Word) {};
}

message Empty {

}

message Word {
  string word = 1;
}

define a service

import { Route, Service } from "grpc-server-ts";

@Service('path_to_hello.proto')
export class HelloService {
  @Route
  public async say() {
    return 'hello world';
  }
}

registry service grpc

import { RpcRegistry, Settings } from 'grpc-server-ts';

@Settings(settings)
class RPC extends RpcRegistry { }
RPC.start();

settings

{
  port: "3333",                     // listen port
  host: "localhost",                // listen host
  ca: "runtime/rpc/ca.crt",         // ca file path
  cert: "runtime/rpc/server.crt",   // cert file path
  key: "runtime/rpc/server.key"     // key file path
}
1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago