/blox_q5

Primary LanguageJavaScript

This is a simple Node.js application that simulates a money transfer system between sender and receiver accounts.

Prerequisites Before you start, ensure you have the following installed on your system:

Node.js npm (Node Package Manager) Getting Started Clone this repository to your local machine.

Navigate to the project directory.

Install the required dependencies for both sender and receiver applications.

Run the sender server:

Open Terminal Command: node sender.js The sender server will start on port 3000.

Receiver Application Open a new terminal and navigate to the receiver directory:

Run the Reciever server:

Open Terminal Command: node reciever.js The sender server will start on port 4000.

How to Use Once both the sender and receiver servers are running, you can use any tool to send POST requests to the sender server's http://localhost:3000/send-data.

Send a POST request with the following JSON format to initiate a transaction:

json { "senderAccount": "Sender123", "amount": 100, "receiverAccount": "Receiver321" }

Replace XXX with the sender's account number and YYY with the receiver's account number.

The sender server will process the transaction, deducting the amount from the sender's balance, and then attempt to send the data to the receiver server.

The receiver server will receive the data, update the receiver's balance, and respond with the success status.

Important Notes This is a simplified example for demonstration purposes and lacks security features, such as authentication and proper error handling. To adapt and extend this code for real-world usage, considering security and reliability concerns. Please note that this README assumes you're running both the sender and receiver applications locally. If you're deploying them on separate servers or platforms, you may need to adjust the URLs accordingly in your API requests.