This project is a simple server side appliation written in Node.js and Express.js to demonstrate how microservices can communicate with each other through RPC calls.
- Efficient communication between microservices through RPC calls.
- Timeout functionality for the API Request.
- Node.js: Backend Environment
- Express.js: Backend Framework
- RabbitMQ: Message Broker (for RPC functionality)
- Node.js
- RabbitMQ
-
Clone the Repository:
git clone https://github.com/Deval1807/Nodejs-rpc cd Nodejs-rpc
-
Install dependencies:
npm install
-
Configure environment variables:
- Create a .env file in the root directory
- Add your RabbitMQ URL
RABBITMQ_URL = <your_RabbitMQ_URL>
- If you are using it locally, the configuration will be:
RABBITMQ_URL = 'amqp://localhost'
-
Make sure to start your RabbitMQ service before starting the server, if you are using RabbitMQ locally.
- If you have already installed RabbitMQ, directly search for
RabbitMQ Service - Start
and you will be able to start it.
- If you have already installed RabbitMQ, directly search for
-
RabbitMQ Management Console
- Once the service is start, go to
http://localhost:15672
for the accessing the management console - If you are unable to access it, you will need to add a plugin for it
- Open RabbitMQ command prompt and run the following command
rabbitmq-plugins enable rabbitmq_management
- Restart your service and it should be working ๐
- Once the service is start, go to
-
Start the server
- Start products.js
node src/products.js
- Start customer.js in a new terminal
node src/customer.js
- Start products.js
-
Once the Server is running,
-
Visit the following link for Customer server
/
:http://localhost:9000
/wishlist
:http://localhost:9000/wishist
-
Visit the following link for Products server
/
:http://localhost:8000
/customer
:http://localhost:8000/customer
We welcome contributions from the community. To contribute, please fork the repository, create a new branch, and submit a pull request. Make sure to follow the coding standards and ethical practices.
For questions or support, please contact Deval Darji by following ways:
-
LinkedIn: Deval Darji
-
Email: [email protected]