An open API service indexing awesome lists of open source software.

https://github.com/joeriddles/nats.js-demo

Simple demo of nat.js with Synadia Cloud / NGS
https://github.com/joeriddles/nats.js-demo

nats natsio

Last synced: about 2 months ago
JSON representation

Simple demo of nat.js with Synadia Cloud / NGS

Awesome Lists containing this project

README

          

# nats.js demo

Simple demo of [nat.js](https://github.com/nats-io/nats.js/) with [Synadia Cloud / NGS](https://docs.synadia.com/cloud/faq).

Setup:
```shell
npm install
```

To run:
```shell
node main.mjs
```

Alternatively, you can run it with the `NATS_CREDS` environment variable:
```shell
NATS_CREDS='...' node main.mjs
# or even...
NATS_CRESDS="$(cat )" node main.mjs
```

Expected output:
```
connected: connect.ngs.global:4222
>>> hello world
<<< hello world
---
connected: jetstream
created stream: users
created durable consumer: user-consumer
>>> 1 data
<<< 1 {"user_id":1}
```

Synadia Cloud — create stream:
![Synadia Cloud stream screenshot](./static/cloud.png)

Docs:
- https://nats-io.github.io/nats.js/
- https://github.com/nats-io/nats.js/
- https://docs.synadia.com/cloud/faq