/event-driven-nodejs

Nodejs event-emitter implementation

Primary LanguageJavaScript

event-driven-nodejs

Explore the power of event-driven architecture in Node.js with this simple CLI ticket project, leveraging the robust EventEmitter class.

How It Works:

  1. Event Emission and Listening: Node.js's EventEmitter class allows seamless event emission and listening.

  2. Server-Client Interaction: The server extends the EventEmitter class, accepting the client object as a parameter in its constructor. Clients utilize the on function, where the first parameter signifies the event name, and the second parameter holds the callback function.

  3. Transmission of Events: Clients transmit events to the server component using the emit function. The event name specifies the type of event, while the associated data ensures meaningful communication.

Run Locally

Clone the project

  git clone https://github.com/shari4ov/event-driven-nodejs.git

Go to the project directory

  cd event-driven-nodejs

Install dependencies

  npm install

Start the server

  npm run start

Experience Event-Driven Magic:

  • Select 'Buy'
  • Enter your email
  • Witness the seamless event transmission between client and server!

Feel the pulse of event-driven architecture in action. Dive into the code, explore the interactions, and amplify your Node.js skills. Happy coding! ✨

🔗 Links

linkedin