New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@betsys-nestjs/grpc

Package Overview
Dependencies
Maintainers
9
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@betsys-nestjs/grpc

Library for bootstrapping grpc hybrid application and health checking of grpc

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
9
Weekly downloads
 
Created
Source

gRPC library

This library is responsible bootstraping GRPC application and providing GRPC client for health checking.

Dependencies

PackageVersion
@grpc/grpc-js^1.8.0
@nestjs/common^10.0.0
@nestjs/microservices^10.0.0
@nestjs/core^10.0.0
@nestjs/terminus^10.0.0
reflect-metadata^0.1.13
rxjs^7.8.0

Usage

To start using this library simply import GrpcBuilder in main.ts as an entry point of Nest application.

const {app, microservice} = await GrpcBuilder.createGrpcApplication(
    TestModule,
    {
        options: {
            url: '0.0.0.0:<port>',
            package: ['<package>'],
            protoPath: ['<protoPath>'],
            loader: {
                includeDirs: [
                    '<pathToProtobuff>'
                ],
            },
        },
        health: true,
    },
)

Then if you enable health checking for the GRPC you want to use GrpcHealthClientModule to initialize GRPC client for calling health check endpoint.

At the place where you want to use GRPC client simply do:

GrpcHealthClientModule.register(port, directoryOfProtofile)

You always need to define port, that would match the port of running GRPC server, and optionally you can define path of proto file with second parameter of register method.

Then you can inject service to any module and use it like this to call the actual health check method:

class HealthIndicator {
    constructor(private readonly grpcHealthClientService: GrpcHealthClientService) {
    }

    async isHealthy() {
        await this.grpcHealthClientService.check()
    }
}

FAQs

Package last updated on 09 Oct 2023

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