Skip to content

Instantly share code, notes, and snippets.

@2pai
2pai / statuscode.js
Created June 23, 2019 01:47
Respond Code HTTP
const STATUS_CODES = {
100: 'Continue',
101: 'Switching Protocols',
102: 'Processing', // RFC 2518, obsoleted by RFC 4918
103: 'Early Hints',
200: 'OK',
201: 'Created',
202: 'Accepted',
203: 'Non-Authoritative Information',
204: 'No Content',
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Realtime Chart</title>
</head>
<body>
const kafka = require('kafka-node');
const socketIO = require('socket.io')(8080) // run socket.io di port 8080
const Consumer = kafka.Consumer;
const client = new kafka.KafkaClient();
const io = socketIO;
const consumer = new Consumer(
client,
[
{ topic: 'nodejs', partition: 0}
],
{
"name": "learn-kafka-node",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"kafka-node": "^4.1.1",
"socket.io": "^2.2.0"
},
"devDependencies": {},