# @dap-js/nest-adapter

> NestJS adapter for DAP protocol

Latest version **1.0.1** (published 2022-06-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @dap-js/nest-adapter
pnpm add @dap-js/nest-adapter
yarn add @dap-js/nest-adapter
bun add @dap-js/nest-adapter
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-06-04 |
| First published | 2022-06-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Konasov Dmitriy |
| Maintainers | dkonasov |

## Links

- npm: https://www.npmjs.com/package/@dap-js/nest-adapter
- Repository: https://github.com/dkonasov/dap-js
- Issues: https://github.com/dkonasov/dap-js/issues
- npm.io page: https://npm.io/package/@dap-js/nest-adapter

## Dependencies (2)

- [@dap-js/client](https://npm.io/package/@dap-js/client.md) ^1.0.4
- [@dap-js/server](https://npm.io/package/@dap-js/server.md) ^1.0.9

## Recent versions

- 1.0.1 (latest) — 2022-06-04

## README

# `@dap-js/nest-adapter`

NestJS microservice adapter for [DAP application protocol](https://github.com/dkonasov/dap)

## Usage

### Server

```ts
// Controller

@Controller()
class AppController {
  @MessagePattern(42)
  testHandler(req: unknown) {
    controllerSpy(req);
    return Buffer.from('General Kenobi?');
  }
}

// main.ts

import { NestFactory } from "@nestjs/core";
import { DapMicroserviceServer } from "@dap-js/nest-adapter";

const app = NestFactory.createMicroservice(AppModule, {
    strategy: new DapMicroserviceServer({port: 1313}),
});

microservice = await app;
await microservice.listen();
```

### Client

```ts
import { DapMicroserviceClient } from '@dap-js/nest-adapter';
import { firstValueFrom } from 'rxjs';

const client = new DapMicroserviceClient('dap://localhost:1313');
const result = await firstValueFrom(client.send<number, {token?: Buffer, payload?: Buffer}>(42, { payload: Buffer.from('Hello there!')}));
```

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