# oscar_nats

> A simple nats connector

Latest version **1.2.0** (published 2021-12-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install oscar_nats
pnpm add oscar_nats
yarn add oscar_nats
bun add oscar_nats
```

## 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.2.0 |
| Published | 2021-12-20 |
| First published | 2021-12-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 13.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Oscar Guerrero |
| Maintainers | oscarlopez75 |

## Links

- npm: https://www.npmjs.com/package/oscar_nats
- Repository: https://github.com/OscarGuerreroLopez/nats_lib
- Issues: https://github.com/OscarGuerreroLopez/nats_lib/issues
- npm.io page: https://npm.io/package/oscar_nats

## Dependencies (3)

- [nats](https://npm.io/package/nats.md) ^2.4.0
- [dotenv](https://npm.io/package/dotenv.md) ^10.0.0
- [express](https://npm.io/package/express.md) ^4.17.1

## Recent versions

- 1.2.0 (latest) — 2021-12-20
- 1.1.6 — 2021-12-20
- 1.1.5 — 2021-12-19
- 1.1.4 — 2021-12-19
- 1.1.3 — 2021-12-19
- 1.1.2 — 2021-12-19
- 1.1.1 — 2021-12-19
- 1.1.0 — 2021-12-19
- 1.0.2 — 2021-12-17
- 1.0.1 — 2021-12-17
- 1.0.0 — 2021-12-17

## README

# Nats connection

This is just a library to handle the nats connection for microservices

## Installation

```bash
npm install oscar_nats
```

## Usage

```
import { Methods, LogType } from "oscar_nats";

// you can inject any logger as longs as it meets the LogType
const logger = (logger: LogType, message: string, data?: unknown) => {
  if (logger === "info") {
    console.log("@@@info", message, data);
  }

  if (logger === "warn") {
    console.log("@@@warn", message, data);
  }

  if (logger === "error") {
    console.log("@@@error", message, data);
  }
};

export const BusMethods = Methods(
  SERVERS,
  TOKEN,
  logger
);
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

## License

[MIT](https://choosealicense.com/licenses/mit/)

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