File tree 5 files changed +38
-1
lines changed
5 files changed +38
-1
lines changed Original file line number Diff line number Diff line change
1
+ node_modules /
Original file line number Diff line number Diff line change @@ -10,4 +10,12 @@ services:
10
10
depends_on :
11
11
- database
12
12
ports :
13
- - 5001:80
13
+ - 5001:80
14
+ prices :
15
+ build : ./prices
16
+ volumes :
17
+ - ./prices:/app
18
+ depends_on :
19
+ - apparel
20
+ ports :
21
+ - 5002:80
Original file line number Diff line number Diff line change
1
+ FROM python
2
+ WORKDIR app
3
+ COPY requirements.txt .
4
+ RUN pip install -r requirements.txt
5
+ COPY . .
6
+ EXPOSE 80
7
+ CMD [ "python" , "app.py" ]
Original file line number Diff line number Diff line change
1
+ import json
2
+ import requests
3
+ from flask import Flask , jsonify
4
+
5
+ app = Flask (__name__ )
6
+
7
+
8
+ @app .route ('/' )
9
+ def prices ():
10
+ data = requests .get ('http://apparel/' ).json ()
11
+
12
+ for i in range (len (data )):
13
+ data [i ]['price' ] = (i * 5 ) + 10
14
+
15
+ return jsonify (data )
16
+
17
+
18
+ if __name__ == '__main__' :
19
+ app .run (host = '0.0.0.0' , port = 80 )
Original file line number Diff line number Diff line change
1
+ Flask == 0.12
2
+ requests == 2.18
You can’t perform that action at this time.
0 commit comments