# @nestcloud2/grpc

> NestCloud is a Node.js micro-service solution, writing by Typescript language and Nest.js.

Latest version **0.8.5** (published 2022-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nestcloud2/grpc
pnpm add @nestcloud2/grpc
yarn add @nestcloud2/grpc
bun add @nestcloud2/grpc
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.5 |
| Published | 2022-09-12 |
| First published | 2022-05-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 21.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 419 |
| Author | Miaowing |
| Maintainers | ahdng |

## Links

- npm: https://www.npmjs.com/package/@nestcloud2/grpc
- Repository: https://github.com/nest-cloud/nestcloud
- Homepage: https://github.com/nest-cloud/nestcloud#readme
- Issues: https://github.com/nest-cloud/nestcloud/issues
- npm.io page: https://npm.io/package/@nestcloud2/grpc

## Recent versions

- 0.8.5 (latest) — 2022-09-12
- 0.9.1 (next) — 2022-10-04
- 0.9.1-rc.0 (test) — 2022-09-14
- 0.8.4 — 2022-07-04
- 0.8.3 — 2022-05-31
- 0.8.0 — 2022-05-16
- 0.7.21 — 2022-05-16
- 0.7.20 — 2022-05-16

## README

[travis-image]: https://api.travis-ci.org/nest-cloud/nestcloud.svg?branch=master
[travis-url]: https://travis-ci.org/nest-cloud/nestcloud
[linux-image]: https://img.shields.io/travis/nest-cloud/nestcloud/master.svg?label=linux
[linux-url]: https://travis-ci.org/nest-cloud/nestcloud

# NestCloud - Grpc

<p align="center">
    <a href="https://www.npmjs.com/~nestcloud" target="_blank"><img src="https://img.shields.io/npm/v/@nestcloud2/core.svg" alt="NPM Version"/></a>
    <a href="https://www.npmjs.com/~nestcloud" target="_blank"><img src="https://img.shields.io/npm/l/@nestcloud2/core.svg" alt="Package License"/></a>
    <a href="https://www.npmjs.com/~nestcloud" target="_blank"><img src="https://img.shields.io/npm/dm/@nestcloud2/core.svg" alt="NPM Downloads"/></a>
    <a href="https://travis-ci.org/nest-cloud/nestcloud" target="_blank"><img src="https://travis-ci.org/nest-cloud/nestcloud.svg?branch=master" alt="Travis"/></a>
    <a href="https://travis-ci.org/nest-cloud/nestcloud" target="_blank"><img src="https://img.shields.io/travis/nest-cloud/nestcloud/master.svg?label=linux" alt="Linux"/></a>
    <a href="https://coveralls.io/github/nest-cloud/nestcloud?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nest-cloud/nestcloud/badge.svg?branch=master" alt="Coverage"/></a>
</p>

## Description

The loadbalance grpc module for nestcloud.

## Installation

```bash
$ npm install --save @nestcloud2/grpc
```

## Quick Start

### Import module

_Before import `GrpcModule`, you need to import [`LoadbalanceModule`][loadbalance] first._

```typescript
import { Module } from '@nestjs/common';
import { LoadbalanceModule } from '@nestcloud2/loadbalance'
import { GrpcModule } from '@nestcloud2/grpc';

@Module({
  imports: [
      LoadbalanceModule.forRoot({...}),
      GrpcModule.forRoot()
  ],
})
export class AppModule {}
```

### Usage

```typescript
import { Controller, Get } from '@nestjs/common';
import { RpcClient, GrpcClient, IClientConfig, Service } from '@nestcloud2/grpc';
import { HeroService } from './interfaces/hero-service.interface';
import { join } from 'path';

const grpcOptions: IClientConfig = {
    service: 'rpc-server',
    package: 'hero',
    protoPath: join(__dirname, './hero.proto'),
};

@Controller()
export class HeroController {
    @RpcClient(grpcOptions)
    private readonly client: GrpcClient;
    @Service('HeroService', grpcOptions)
    private readonly heroService: HeroService;

    @Get()
    async execute(): Promise<any> {
        return await this.heroService.get({ id: 1 }).toPromise();
    }
}
```

More please visit the example: https://github.com/nest-cloud/nestcloud-grpc-example

## Stay in touch

-   Author - [NestCloud](https://github.com/nest-cloud)

## License

NestCloud is [MIT licensed](LICENSE).

[loadbalance]: https://github.com/nest-cloud/nestcloud/tree/master/packages/loadbalance

---
_Source: https://npm.io/package/@nestcloud2/grpc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
