https://github.com/0x4bd0/nestjs-microservices-tcp-example
NestJs microservices with TCP as a transport.
https://github.com/0x4bd0/nestjs-microservices-tcp-example
microservices nest nestjs nestjs-backend
Last synced: 3 months ago
JSON representation
NestJs microservices with TCP as a transport.
- Host: GitHub
- URL: https://github.com/0x4bd0/nestjs-microservices-tcp-example
- Owner: 0x4bd0
- Created: 2021-03-04T21:38:34.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-04T22:53:26.000Z (over 4 years ago)
- Last Synced: 2025-03-26T09:18:38.265Z (3 months ago)
- Topics: microservices, nest, nestjs, nestjs-backend
- Language: TypeScript
- Homepage:
- Size: 188 KB
- Stars: 7
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NestJs microservices examples
In this example, we'll see a really basic math microservice using TCP as a transport,
we have a basic microservice that does math operations for us, in our example, it does a sum of an array of numbers that we'll be passing through our HTTP server.## Installation
We just need to install our npm packages
```bash
cd http-server
npm install
cd ../math-microservice
npm install
```## Usage
First, we need to start the projects, open each project in a different terminal for a good view of what's going on.```bash
cd http-server
npm run start:dev
cd math-microservice
npm run start:dev
```Then all we have to do is request our HTTP server with insomnia or postman or whatever you prefer using,
## Example
```bash
POST localhost:3000/sum
BODY { data : [6,2,9] }
```## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)