Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions api-gateway/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ const httpProxy = require("http-proxy");
const proxy = httpProxy.createProxyServer();
const app = express();

app.use((req, res, next) => {
console.log(`[API Gateway][Docker] ${req.method} ${req.originalUrl}`);
next();
});

const AUTH_SERVICE_HOST = process.env.AUTH_SERVICE_HOST || "auth";
const AUTH_SERVICE_PORT = process.env.AUTH_SERVICE_PORT || "3000";
const PRODUCT_SERVICE_HOST = process.env.PRODUCT_SERVICE_HOST || "product";
Expand Down
3 changes: 2 additions & 1 deletion api-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
"start": "node index.js",
"dev": "node --watch index.js"
},
"keywords": [],
"author": "",
Expand Down
3 changes: 2 additions & 1 deletion auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"test": "mocha --timeout 20000 src/test/**/*.test.js --exit",
"start": "node index.js"
"start": "node index.js",
"dev": "node --watch index.js"
},
"keywords": [],
"author": "",
Expand Down
6 changes: 6 additions & 0 deletions auth/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ class App {
setMiddlewares() {
this.app.use(express.json());
this.app.use(express.urlencoded({ extended: false }));
this.app.use((req, res, next) => {
console.log(
`[Auth Service][Docker] ${req.method} ${req.originalUrl}`
);
next();
});
}

setRoutes() {
Expand Down
18 changes: 17 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ services:
- auth/.env
ports:
- "3000:3000"
volumes:
- ./auth:/usr/src/app
- /usr/src/app/node_modules
command: npm run dev
depends_on:
- mongo

Expand All @@ -34,17 +38,25 @@ services:
- product/.env
ports:
- "3001:3001"
volumes:
- ./product:/usr/src/app
- /usr/src/app/node_modules
command: npm run dev
depends_on:
- mongo
- rabbitmq


order:
build: ./order
env_file:
- order/.env
ports:
- "3002:3002"
volumes:
- ./order:/usr/src/app
- /usr/src/app/node_modules
command: npm run dev
depends_on:
- mongo
- rabbitmq
Expand All @@ -53,6 +65,10 @@ services:
build: ./api-gateway
ports:
- "3003:3003"
volumes:
- ./api-gateway:/usr/src/app
- /usr/src/app/node_modules
command: npm run dev
depends_on:
- auth
- product
Expand Down
3 changes: 2 additions & 1 deletion order/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
"start": "node index.js",
"dev": "node --watch index.js"
},
"keywords": [],
"author": "",
Expand Down
4 changes: 4 additions & 0 deletions order/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ const config = require("./config");
class App {
constructor() {
this.app = express();
this.app.use((req, res, next) => {
console.log(`[Order Service][Docker] ${req.method} ${req.originalUrl}`);
next();
});
this.connectDB();
this.setupOrderConsumer();
}
Expand Down
3 changes: 2 additions & 1 deletion product/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "app.js",
"scripts": {
"test": "mocha --timeout 20000 src/test/**/*.test.js --exit",
"start": "node index.js"
"start": "node index.js",
"dev": "node --watch index.js"
},
"keywords": [],
"author": "",
Expand Down
6 changes: 6 additions & 0 deletions product/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ class App {
setMiddlewares() {
this.app.use(express.json());
this.app.use(express.urlencoded({ extended: false }));
this.app.use((req, res, next) => {
console.log(
`[Product Service][Docker] ${req.method} ${req.originalUrl}`
);
next();
});
}

setRoutes() {
Expand Down
Loading