File tree Expand file tree Collapse file tree 9 files changed +46
-5
lines changed
Expand file tree Collapse file tree 9 files changed +46
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ const httpProxy = require("http-proxy");
44const proxy = httpProxy . createProxyServer ( ) ;
55const app = express ( ) ;
66
7+ app . use ( ( req , res , next ) => {
8+ console . log ( `[API Gateway][Docker] ${ req . method } ${ req . originalUrl } ` ) ;
9+ next ( ) ;
10+ } ) ;
11+
712const AUTH_SERVICE_HOST = process . env . AUTH_SERVICE_HOST || "auth" ;
813const AUTH_SERVICE_PORT = process . env . AUTH_SERVICE_PORT || "3000" ;
914const PRODUCT_SERVICE_HOST = process . env . PRODUCT_SERVICE_HOST || "product" ;
Original file line number Diff line number Diff line change 55 "main" : " index.js" ,
66 "scripts" : {
77 "test" : " echo \" Error: no test specified\" && exit 1" ,
8- "start" : " node index.js"
8+ "start" : " node index.js" ,
9+ "dev" : " node --watch index.js"
910 },
1011 "keywords" : [],
1112 "author" : " " ,
Original file line number Diff line number Diff line change 55 "main" : " index.js" ,
66 "scripts" : {
77 "test" : " mocha --timeout 20000 src/test/**/*.test.js --exit" ,
8- "start" : " node index.js"
8+ "start" : " node index.js" ,
9+ "dev" : " node --watch index.js"
910 },
1011 "keywords" : [],
1112 "author" : " " ,
Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ class App {
2929 setMiddlewares ( ) {
3030 this . app . use ( express . json ( ) ) ;
3131 this . app . use ( express . urlencoded ( { extended : false } ) ) ;
32+ this . app . use ( ( req , res , next ) => {
33+ console . log (
34+ `[Auth Service][Docker] ${ req . method } ${ req . originalUrl } `
35+ ) ;
36+ next ( ) ;
37+ } ) ;
3238 }
3339
3440 setRoutes ( ) {
Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ services:
2525 - auth/.env
2626 ports :
2727 - " 3000:3000"
28+ volumes :
29+ - ./auth:/usr/src/app
30+ - /usr/src/app/node_modules
31+ command : npm run dev
2832 depends_on :
2933 - mongo
3034
@@ -34,17 +38,25 @@ services:
3438 - product/.env
3539 ports :
3640 - " 3001:3001"
41+ volumes :
42+ - ./product:/usr/src/app
43+ - /usr/src/app/node_modules
44+ command : npm run dev
3745 depends_on :
3846 - mongo
3947 - rabbitmq
40-
48+
4149
4250 order :
4351 build : ./order
4452 env_file :
4553 - order/.env
4654 ports :
4755 - " 3002:3002"
56+ volumes :
57+ - ./order:/usr/src/app
58+ - /usr/src/app/node_modules
59+ command : npm run dev
4860 depends_on :
4961 - mongo
5062 - rabbitmq
@@ -53,6 +65,10 @@ services:
5365 build : ./api-gateway
5466 ports :
5567 - " 3003:3003"
68+ volumes :
69+ - ./api-gateway:/usr/src/app
70+ - /usr/src/app/node_modules
71+ command : npm run dev
5672 depends_on :
5773 - auth
5874 - product
Original file line number Diff line number Diff line change 55 "main" : " index.js" ,
66 "scripts" : {
77 "test" : " echo \" Error: no test specified\" && exit 1" ,
8- "start" : " node index.js"
8+ "start" : " node index.js" ,
9+ "dev" : " node --watch index.js"
910 },
1011 "keywords" : [],
1112 "author" : " " ,
Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ const config = require("./config");
77class App {
88 constructor ( ) {
99 this . app = express ( ) ;
10+ this . app . use ( ( req , res , next ) => {
11+ console . log ( `[Order Service][Docker] ${ req . method } ${ req . originalUrl } ` ) ;
12+ next ( ) ;
13+ } ) ;
1014 this . connectDB ( ) ;
1115 this . setupOrderConsumer ( ) ;
1216 }
Original file line number Diff line number Diff line change 55 "main" : " app.js" ,
66 "scripts" : {
77 "test" : " mocha --timeout 20000 src/test/**/*.test.js --exit" ,
8- "start" : " node index.js"
8+ "start" : " node index.js" ,
9+ "dev" : " node --watch index.js"
910 },
1011 "keywords" : [],
1112 "author" : " " ,
Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ class App {
3030 setMiddlewares ( ) {
3131 this . app . use ( express . json ( ) ) ;
3232 this . app . use ( express . urlencoded ( { extended : false } ) ) ;
33+ this . app . use ( ( req , res , next ) => {
34+ console . log (
35+ `[Product Service][Docker] ${ req . method } ${ req . originalUrl } `
36+ ) ;
37+ next ( ) ;
38+ } ) ;
3339 }
3440
3541 setRoutes ( ) {
You can’t perform that action at this time.
0 commit comments