Skip to content

Latest commit

 

History

History
78 lines (53 loc) · 1.35 KB

README.md

File metadata and controls

78 lines (53 loc) · 1.35 KB

Node.js Pub Sub API with Apache Kafka & Discord Integration

This is a simple demo Node.js API that receives a POST request on the /accounts route and produces a message to the account-created topic.

There is also a consumer API that subscribes to this topic and publishes this message to the discord group via webhook.

Local Installation

First of all, clone this repo:

git clone git@github.com:leonardopliski/node-apache-kafka.git

Move to the project dir:

cd node-apache-kafka/

Create a discord Webhook

Set the discord webhook environment variable: DISCORD_WEBHOOK_URL

export DISCORD_WEBHOOK_URL=<your-webhook-url-right-here>

With NVM run:

nvm use

With NPM run:

npm install

With Docker Compose installed just run:

npm run up

Start the main API.

npm run start:server

Start the subscriber API.

npm run start:consumer

Done! Execute a POST request to the following URL:

http://localhost:5050/accounts

body: {
  "email": "test@gmail.com"
}

A message should appear on the Discord group.

Technologies

  • Kafka
  • ZooKeeper
  • Axios
  • Node.js
  • NVM
  • Express
  • Nodemon