GithubHelp home page GithubHelp logo

wwwsolutions / nestjs-nats Goto Github PK

View Code? Open in Web Editor NEW

This project forked from beeman/nestjs-nats

0.0 1.0 0.0 134 KB

NX Workspace with 2 NestJS api's passing messages along using nats.

License: MIT License

Dockerfile 6.35% JavaScript 5.75% TypeScript 87.90%

nestjs-nats's Introduction

NestJS Nats Demo

Installation

git clone https://github.com/beeman/nestjs-nats
cd nestjs-nats
yarn install

Usage

Make sure nats is running:

docker-compose up nats

Then in another terminal start the master:

yarn start:master

And in another terminal start the minion:

yarn start:minion

You can now use curl to invoke the sum method on the master using a http call:

curl 'localhost:3333/api/sum?digits=13,29'
# [master] MasterAppController picks up the request, splits the digits in to number[]
# [master] Sum method gets called on MasterAppService passing in the number[]
# [master] MasterAppService sends the { cmd: 'sum' } passing along the number[]
# [nats]
# [minion] MinionAppController picks up the { cmd: 'sum' }
# [minion] Sum method gets called on MinionAppService generation the result
# Results gets passed back the same route upwards.
42
curl 'localhost:3333/api/reverse?message=hello'
olleh

License

MIT 2019 Bram Borggreve

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.