πŸ“¦ joeriddles / nats.js-demo

Simple demo of nat.js with Synadia Cloud / NGS

β˜… 0 stars β‘‚ 0 forks πŸ‘ 0 watching
natsnatsio
πŸ“₯ Clone https://github.com/joeriddles/nats.js-demo.git
HTTPS git clone https://github.com/joeriddles/nats.js-demo.git
SSH git clone git@github.com:joeriddles/nats.js-demo.git
CLI gh repo clone joeriddles/nats.js-demo
Joseph Riddle Joseph Riddle Add env.NATS_CREDS support 7407bf0 10 months ago πŸ“ History
πŸ“‚ main View all commits β†’
πŸ“ .vscode
πŸ“ static
πŸ“„ .gitignore
πŸ“„ main.mjs
πŸ“„ package.json
πŸ“„ README.md
πŸ“„ README.md

nats.js demo

Simple demo of nat.js with Synadia Cloud / NGS.

Setup:

npm install

To run:

node main.mjs <nats_creds_file>

Alternatively, you can run it with the NATS_CREDS environment variable:

NATS_CREDS='...' node main.mjs
# or even...
NATS_CRESDS="$(cat <nats_creds_file>)" 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

Docs:

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