Skip to content

Commit 286444d

Browse files
committed
Clean up api-gateway index and docker-compose yml
1 parent d3ad357 commit 286444d

File tree

2 files changed

+22
-86
lines changed

2 files changed

+22
-86
lines changed

ApiGatewayService/src/index.ts

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,33 @@
11
import express from "express";
22
import httpProxy from "http-proxy";
33
import cors from "cors";
4-
// import http from 'http';
5-
// import { Server } from 'socket.io';
64

75
const app = express();
86
const proxy = httpProxy.createProxyServer();
97
app.use(cors());
108

11-
// // Create an HTTP server and attach Socket.IO to it
12-
// const server = http.createServer(app);
13-
// const io = new Server(server, {
14-
// cors: {
15-
// origin: '*',
16-
// },
17-
// path: 'ws'
18-
// });
19-
209
// Define routes for each backend service for local development
2110
// app.use('/questionservice', (req, res) => {
2211
// proxy.web(req, res, { target: 'http://localhost:3002' });
2312
// });
24-
2513
// app.use('/authservice', (req, res) => {
2614
// proxy.web(req, res, { target: 'http://localhost:3003' });
2715
// });
28-
2916
// app.use('/userservice', (req, res) => {
3017
// proxy.web(req, res, { target: 'http://localhost:3004' });
3118
// });
3219

33-
// app.use('/matchingservice', (req, res) => {
34-
// proxy.web(req, res, { target: 'http://localhost:3005' });
35-
// });
36-
37-
//Define routes for each backend service for production/docker containers
20+
// Define routes for each backend service for production/docker containers
3821
app.use("/questionservice", (req, res) => {
39-
proxy.web(req, res, { target: "http://localhost:3002" });
40-
//http://question-service:3002
41-
//http://localhost:3002
22+
proxy.web(req, res, { target: "http://question-service:3002" });
4223
});
43-
4424
app.use("/authservice", (req, res) => {
45-
proxy.web(req, res, { target: "http://localhost:3003" });
46-
//http://auth-service:3003
47-
//http://localhost:3003
25+
proxy.web(req, res, { target: "http://auth-service:3003" });
4826
});
49-
5027
app.use("/userservice", (req, res) => {
51-
proxy.web(req, res, { target: "http://localhost:3004" });
52-
// http://user-service:3004
53-
//http://localhost:3004
54-
});
55-
56-
app.use("/matchingservice", (req, res) => {
57-
proxy.web(req, res, { target: "http://localhost:3005" });
58-
//http://matching-service:3005
59-
//http://localhost:3005
28+
proxy.web(req, res, { target: "http://user-service:3004" });
6029
});
6130

62-
//Define routes for each backend service for production/docker containers
63-
// app.use("/questionservice", (req, res) => {
64-
// proxy.web(req, res, { target: "http://question-service:3002" });
65-
// });
66-
67-
// app.use("/authservice", (req, res) => {
68-
// proxy.web(req, res, { target: "http://auth-service:3003" });
69-
// });
70-
71-
// app.use("/userservice", (req, res) => {
72-
// proxy.web(req, res, { target: "http://user-service:3004" });
73-
// });
74-
75-
// app.use("/matchingservice", (req, res) => {
76-
// proxy.web(req, res, { target: "http://matching-service:3005" });
77-
// });
78-
7931

8032
// Start the server
8133
app.listen(3001, () => {

docker-compose.yml

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
version: '3'
22
services:
3+
frontend:
4+
container_name: frontend
5+
build:
6+
context: ./frontend
7+
image: frontend-image
8+
ports:
9+
- "3000:3000"
10+
311
api-gateway:
412
container_name: api-gateway
513
build:
@@ -13,56 +21,32 @@ services:
1321
build:
1422
context: ./AuthService
1523
image: auth-service-image
16-
# ports:
17-
# - "3001:3001"
18-
19-
matching-service:
20-
container_name: matching-service
21-
build:
22-
context: ./MatchingService
23-
image: matching-service-image
24-
ports:
25-
- "3005:3005"
26-
stdin_open: true
2724

2825
question-service:
2926
container_name: question-service
3027
build:
3128
context: ./QuestionService
3229
image: question-service-image
33-
# ports:
34-
# - "3001:3001"
3530

3631
user-service:
3732
container_name: user-service
3833
build:
3934
context: ./UserService
4035
image: user-service-image
41-
# ports:
42-
# - "3001:3001"
43-
44-
# collab-service:
45-
# container_name: collab-service
46-
47-
# build:
48-
# context: ./CollabService
49-
# image: collab-service-image
50-
# ports:
51-
# - "3006:3006"
52-
5336

37+
matching-service:
38+
container_name: matching-service
39+
build:
40+
context: ./MatchingService
41+
image: matching-service-image
42+
ports:
43+
- "3005:3005"
44+
stdin_open: true
45+
5446
chat-service:
5547
container_name: chat-service
5648
build:
5749
context: ./ChatService
5850
image: chat-service-image
5951
ports:
60-
- "3007:3007"
61-
62-
frontend:
63-
container_name: frontend
64-
build:
65-
context: ./frontend
66-
image: frontend-image
67-
ports:
68-
- "3000:3000"
52+
- "3007:3007"

0 commit comments

Comments
 (0)