Skip to content

Decorators that makes using gRPC easier in Typescript.

Notifications You must be signed in to change notification settings

naueramant/grpcd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gRPCd

Making gRPC services easier to use in typescript.

Installation

yarn add grpcd 

Example

import { server, Service, RPC, Errors } from 'grpcd';
import { HelloParameters, HelloResponse, ErrorResponse, ErrorParameters } from './hello_pb';

@Service(__dirname + '/hello.proto')
class HelloService {

    private counter = 1;

    @RPC()
    public hello(params: HelloParameters.AsObject): HelloResponse.AsObject {
        return {
            response: `Hello ${params.name} number ${this.counter++}`
        };
    }

    // Throw a grpc error
    @RPC()
    public error(params: ErrorParameters.AsObject): ErrorResponse.AsObject {
        throw new Errors.NotFoundError("Greeting was not found!!");
    }
}

server.addService(new HelloService());
server.start();

TODO:

  • Service decorator
  • RPC decorator
  • Async calls
  • Throwing errors
  • gRPC streaming

Protobox

For easier source file and dependency management for gRPC checkout protobox.

About

Decorators that makes using gRPC easier in Typescript.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published