This repository is an example of NSQ in Node JS using nsqjs, I built very simple app for convert text to uppercase, so we can publish
some text, and that text will convert to uppercase by subscriber
.
-
Publisher ->
writer.js
-
Subscriber ->
reader.js
For setup repository you must only run :
npm run setup
It's will copy
.env.example
to.env
and then install dependencies
Or you can copy manually .env.example
to .env
and then run :
npm i
Make sure configuration for NSQ in .env
is correct (according to your environment).
Run subscriber to listen all messages from publisher :
npm run reader
After reader.js was running, you can test it with send default message, with run this :
npm run writer:test
Or you can send custom text, using this command :
npm run writer <INPUT_TEXT>
Replace <INPUT_TEXT>
with text as you like, for example :
npm run writer "Luffy is not paramecia type"
You can using quote or not