forked from paktek123/testdriven-loadbalancer-tdd-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
36 lines (24 loc) · 718 Bytes
/
app.py
File metadata and controls
36 lines (24 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/')
def sample():
return jsonify(
message=f'This is the {os.environ["APP"]} application.',
server=request.base_url,
custom_header=request.headers.get('MyCustomHeader', None),
host_header=request.headers.get('Host', request.base_url),
custom_params=request.args.get('MyCustomParam', None),
query_strings=request.query_string.decode('utf-8'),
)
@app.route('/healthcheck')
def healthcheck():
return 'OK'
@app.route('/v1')
def v1():
return "This is V1"
@app.route('/v2')
def v2():
return "This is V2"
if __name__ == '__main__':
app.run(host='0.0.0.0')