Skip to content

Commit 2b13d14

Browse files
committed
inital commmit
0 parents  commit 2b13d14

21 files changed

+8256
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
build
3+
npm-debug.log
4+
.env
5+
.DS_Store

deployments/docker-compose.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: "2"
2+
services:
3+
zookeeper:
4+
image: confluentinc/cp-zookeeper:latest
5+
environment:
6+
ZOOKEEPER_CLIENT_PORT: 2181
7+
ZOOKEEPER_TICK_TIME: 2000
8+
ports:
9+
- 22181:2181
10+
11+
kafka:
12+
image: confluentinc/cp-kafka:latest
13+
depends_on:
14+
- zookeeper
15+
ports:
16+
- 29092:29092
17+
environment:
18+
KAFKA_BROKER_ID: 1
19+
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
20+
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
21+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
22+
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
23+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
24+
25+
kafka_ui:
26+
image: provectuslabs/kafka-ui:latest
27+
depends_on:
28+
- kafka
29+
ports:
30+
- 8080:8080
31+
environment:
32+
KAFKA_CLUSTERS_0_ZOOKEEPER: zookeeper:2181
33+
KAFKA_CLUSTERS_0_NAME: local
34+
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:9092

dist/app.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
require("reflect-metadata");
4+
const routing_controllers_1 = require("routing-controllers");
5+
const PeopleController_1 = require("./controllers/PeopleController");
6+
const app = (0, routing_controllers_1.createExpressServer)({
7+
controllers: [PeopleController_1.PeopleController],
8+
});
9+
app.listen(3000, () => {
10+
console.log("app up and running ");
11+
});

dist/controllers/PeopleController.js

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
"use strict";
2+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6+
return c > 3 && r && Object.defineProperty(target, key, r), r;
7+
};
8+
var __metadata = (this && this.__metadata) || function (k, v) {
9+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10+
};
11+
var __param = (this && this.__param) || function (paramIndex, decorator) {
12+
return function (target, key) { decorator(target, key, paramIndex); }
13+
};
14+
Object.defineProperty(exports, "__esModule", { value: true });
15+
exports.PeopleController = void 0;
16+
const routing_controllers_1 = require("routing-controllers");
17+
let PeopleController = class PeopleController {
18+
constructor() {
19+
this.PEOPLES_DB = [];
20+
}
21+
getAllPeople() {
22+
console.log("GET ALL PEOPLES API called");
23+
return this.PEOPLES_DB;
24+
}
25+
getPeopleById(id) {
26+
console.log("GET PEOPLE ID API called");
27+
let peoples = this.PEOPLES_DB.filter((data) => data.id && data.id === id);
28+
return peoples;
29+
}
30+
savePeople(myPeople) {
31+
let id = Math.random();
32+
console.log(`save PEOPLE API called :: ${id}`);
33+
myPeople.id = id;
34+
this.PEOPLES_DB.push(myPeople);
35+
return myPeople;
36+
}
37+
deletePeople(id) {
38+
let peopleId = this.PEOPLES_DB.findIndex((data) => data.id === id);
39+
console.log(`DELETE PEOPLE API called :: ${id}`);
40+
if (peopleId != null) {
41+
this.PEOPLES_DB.splice(peopleId, 1);
42+
}
43+
}
44+
updateMyPeople(id, myPeople) {
45+
console.log(`update PEOPLE API called :: ${id}`);
46+
this.PEOPLES_DB.map((data) => data.id && data.id === id ? Object.assign(Object.assign({}, data), { myPeople }) : data);
47+
console.log(`people updated successfully`);
48+
return this.PEOPLES_DB.filter((people) => people.id === id);
49+
}
50+
};
51+
exports.PeopleController = PeopleController;
52+
__decorate([
53+
(0, routing_controllers_1.Get)("/"),
54+
__metadata("design:type", Function),
55+
__metadata("design:paramtypes", []),
56+
__metadata("design:returntype", Array)
57+
], PeopleController.prototype, "getAllPeople", null);
58+
__decorate([
59+
(0, routing_controllers_1.Get)("/:id"),
60+
__param(0, (0, routing_controllers_1.Param)("id")),
61+
__metadata("design:type", Function),
62+
__metadata("design:paramtypes", [Number]),
63+
__metadata("design:returntype", Array)
64+
], PeopleController.prototype, "getPeopleById", null);
65+
__decorate([
66+
(0, routing_controllers_1.Get)("/"),
67+
__param(0, (0, routing_controllers_1.Body)()),
68+
__metadata("design:type", Function),
69+
__metadata("design:paramtypes", [People]),
70+
__metadata("design:returntype", People)
71+
], PeopleController.prototype, "savePeople", null);
72+
__decorate([
73+
(0, routing_controllers_1.Delete)("/:id"),
74+
__param(0, (0, routing_controllers_1.Param)("id")),
75+
__metadata("design:type", Function),
76+
__metadata("design:paramtypes", [Number]),
77+
__metadata("design:returntype", void 0)
78+
], PeopleController.prototype, "deletePeople", null);
79+
__decorate([
80+
(0, routing_controllers_1.Put)("/:id"),
81+
__param(0, (0, routing_controllers_1.Param)("id")),
82+
__param(1, (0, routing_controllers_1.Body)()),
83+
__metadata("design:type", Function),
84+
__metadata("design:paramtypes", [Number, People]),
85+
__metadata("design:returntype", void 0)
86+
], PeopleController.prototype, "updateMyPeople", null);
87+
exports.PeopleController = PeopleController = __decorate([
88+
(0, routing_controllers_1.JsonController)("/api/people")
89+
], PeopleController);
90+
class People {
91+
}

dist/models/People.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.People = void 0;
4+
class People {
5+
}
6+
exports.People = People;

0 commit comments

Comments
 (0)