-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathapp.py
49 lines (42 loc) · 1.02 KB
/
app.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
from flask import Flask, make_response, request
import os
app = Flask(__name__)
@app.route('/')
def hello():
response = make_response(
{
'response': 'Hello, World!',
'status': 200
}
)
return response
@app.route('/repeat', methods=['GET'])
def repeat():
input= request.args.get('input','')
response = make_response(
{
'body': input,
'status': 200
}
)
return response
@app.route('/health')
@app.route('/healthcheck')
def health():
response = make_response(
{
'body': 'OK',
'status': 200
}
)
return response
@app.route('/hang')
def hang():
while True:
pass
if __name__ == '__main__':
# By default flask is only accessible from localhost.
# Set this to '0.0.0.0' to make it accessible from any IP address
# on your network (not recommended for production use)
PORT =os.getenv("PORT")
app.run(host='0.0.0.0', port = PORT, debug=True, threaded=False)