Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ddadaal/tsgrpc

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ddadaal/tsgrpc

A simple gRPC Server Framework for TypeScript Node.js

  • 0.0.4
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

tsgrpc

npm

A minimal Node.JS TypeScript gRPC Server framework.

Install

npm install --save @ddadaal/tsgrpc

Features

  • Plugin system with similar API to fastify (fastify plugin API)
    • Use module augmentation to provide type information to all plugins in the project
  • Graceful shutdown with register-able on close hook
  • Custom logger (source code)
  • Allow writing async function as handleUnaryCall
  • Built in, simple config gRPC code generation
  • Type checked env config builder with built-in env value interpolation (test_${JEST_WORKER_ID} => test_${process.env.JEST_WORKER_ID})
  • Utiliy functions like
    • unpromisify: write server implementation as async function
    • asyncClientCall: calling grpc client as promise. Throws if client call causes error.
    • ensureNotUndefined: check fields that must not be undefined. Return type has checked fields required!

Proto Generation

Create tsgrpc.json with the following content to specify paths to proto files

{
  "targetPath": "src/generated",
  "protos": [
    {
      "path": "../protos",
      "name": "billing"
    },
    {
      "path": "../../management/protos",
      "name": "management"
    }
  ]
}

All paths are relative to pwd. The name field will be used as the name of the sub directory containing files of the protos.

Run npx tsgrpc protos, and the files will be generated to ${targetPath}/${name of the proto}.

If targetPath is undefined, it defaults to src/generated.

Dependencies

License

MIT

FAQs

Package last updated on 20 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc