Skip to content

n3rdyme/grpc-async

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published