grpc-async
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

grpc-async

A simple, declarative approach to creating a grpc server supporting async/await

Install:

npm install grpc-async

Usage:

import path from 'path';
import { grpcStart, CallArgument, GrpcServerConfig } from 'grpc-async';

const config: GrpcServerConfig = {
    binding: '0.0.0.0',
    port: 9090,
    protos: ['com/**/*Service.proto'],
    options: {
        keepCase: true,
        longs: Number,
        enums: String,
        defaults: true,
        oneofs: true,
        includeDirs: [path.resolve(__dirname, './proto')],
    },
    services: {
        'com.helloWorld.HelloService': {
          async Hello(request: any, call: CallArgument) {
              return { say: 'hi' };
          }
        },
    },
};

grpcStart(config)
    .then(stop => console.log('Ready.'))
    .catch(console.error);

Readme

Keywords

Package Sidebar

Install

npm i grpc-async

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

16.4 kB

Total Files

16

Last publish

Collaborators

  • n3rdyme