@fonoster/grpc-health-check
TypeScript icon, indicating that this package has built-in type declarations

3.1.6 • Public • Published

gRPC Health Check

An implementation of gRPC health checks, for node.js-based apps that uses @grpc/grpc-js as a base.

Installation

yarn add git+https://github.com/fonoster/grpc-health-check.git

Usage

/**
 * server.ts
 */
import * as grpc from '@grpc/grpc-js';
import { useHealth } from '@fonoster/grpc-health-check';

const server = useHealth(new grpc.Server());

server.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), () => server.start());
/**
 * client.ts
 */
import * as grpc from '@grpc/grpc-js';
import { HealthClient } from '@fonoster/grpc-health-check';

const health = new HealthClient('localhost:50051');

const { status } = await health.check('SERVICE');

console.info('The app is ready to serve!', status);

Authors

This repository is a clone of kalos, thanks to Nicolas Pearson for his implementation.

License

Released under the MIT License. Extended from kalos repository.

Package Sidebar

Install

npm i @fonoster/grpc-health-check

Weekly Downloads

4,253

Version

3.1.6

License

MIT

Unpacked Size

29.8 kB

Total Files

34

Last publish

Collaborators

  • fonoster-oss