# nestjs-etcd

> Etcd3 module for Nest framework

Latest version **0.2.0** (published 2021-01-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install nestjs-etcd
pnpm add nestjs-etcd
yarn add nestjs-etcd
bun add nestjs-etcd
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2021-01-07 |
| First published | 2021-01-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 18.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Aleksandr Yackovlev |
| Maintainers | aleksandryackovlev |
| Keywords | nestjs, nest, nodejs, typescript, etcd, etcd3 |

## Links

- npm: https://www.npmjs.com/package/nestjs-etcd
- Repository: https://github.com/aleksandryackovlev/nestjs-etcd
- Homepage: https://github.com/aleksandryackovlev/nestjs-etcd#readme
- Issues: https://github.com/aleksandryackovlev/nestjs-etcd/issues
- npm.io page: https://npm.io/package/nestjs-etcd

## Dependencies (1)

- [etcd3](https://npm.io/package/etcd3.md) ^1.1.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2021-01-07
- 0.1.1 — 2021-01-06
- 0.1.0 — 2021-01-06

## README

<div align="center">
  <a href="https://etcd.io/">
    <img src="https://raw.githubusercontent.com/cncf/artwork/master/projects/etcd/horizontal/color/etcd-horizontal-color.png" alt="Etcd logo" width="260">
  </a>
  <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="280" alt="Nest Logo" /></a>
</div>

[![npm][npm]][npm-url]
[![deps][deps]][deps-url]
[![Build Status](https://github.com/aleksandryackovlev/nestjs-etcd/workflows/build/badge.svg)](https://github.com/aleksandryackovlev/nestjs-etcd/actions)
[![codecov](https://codecov.io/gh/aleksandryackovlev/nestjs-etcd/branch/main/graph/badge.svg)](https://codecov.io/gh/aleksandryackovlev/nestjs-etcd)
[![size](https://packagephobia.now.sh/badge?p=nestjs-etcd)](https://packagephobia.now.sh/result?p=nestjs-etcd)

## Description

[Etcd3](https://github.com/microsoft/etcd3) module for [Nest](https://github.com/nestjs/nest).

## Installation

```bash
$ npm i --save nestjs-etcd
```

### Getting Started
To register the EtcdModule in `app.module.ts`

```typescript
import { Module } from '@nestjs/common';
import { EtcdModule} from 'nestjs-etcd';

@Module({
    imports: [
        EtcdModule.forRoot({
            name: 'client_name', // optional, default to 'default'
            hosts: `http://0.0.0.0:2379`,
        }),
    ],
})
export class AppModule {}
```
With Async
```typescript
import { Module } from '@nestjs/common';
import { EtcdModule} from 'nestjs-etcd';

@Module({
    imports: [
        EtcdModule.forRootAsync({
                name: 'client_name', // optional, default to 'default'
                useFactory: (configService: ConfigService) => ({
                hosts: configService.get('hosts'),
            }),
            inject:[ConfigService],
        }),
    ],
})
export class AppModule {}
```
Module supports all the options for [Etcd3](https://www.npmjs.com/package/etcd3) package (see https://microsoft.github.io/etcd3/interfaces/ioptions.html):
```typescript
type EtcdModuleOptions = IOptions & { name?: string }
```
### Usage
```typescript
import { Injectable } from '@nestjs/common';
import { Etcd3 } from 'etcd3';
import { InjectClient } from 'nestjs-etcd';

@Injectable()
export class TestService {
    // client_name is optional for InjectClient, default to 'default'
    constructor(@InjectClient('client_name') private readonly client: Etcd3) {}
    
    find(key: string): Promise<string> {
        return this.client.get(key).string();
    }
}
```
## Contributing

Please take a moment to read our contributing guidelines if you haven't yet done so.

[CONTRIBUTING](./.github/CONTRIBUTING.md)

## License

[MIT](./LICENSE)

[npm]: https://img.shields.io/npm/v/nestjs-etcd.svg
[npm-url]: https://npmjs.com/package/nestjs-etcd
[deps]: https://david-dm.org/aleksandryackovlev/nestjs-etcd.svg
[deps-url]: https://david-dm.org/aleksandryackovlev/nestjs-etcd

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