Skip to content

Pub/Sub demo API that creates a message on Discord when an account is created.

Notifications You must be signed in to change notification settings

leonardopliski/node-kafka-discord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 [email protected]: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": "[email protected]"
}

A message should appear on the Discord group.

Technologies

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

About

Pub/Sub demo API that creates a message on Discord when an account is created.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published