-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
38 lines (29 loc) · 934 Bytes
/
app.py
File metadata and controls
38 lines (29 loc) · 934 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
37
38
from flask import Flask
from flask import json
import logging
app = Flask(__name__)
@app.route('/status')
def status():
response = app.response_class(
response=json.dumps({"result": "OK - healthy"}),
status=200,
mimetype='application/json'
)
app.logger.info('Status request successfull')
return response
@app.route('/metrics')
def metrics():
response = app.response_class(
response=json.dumps({"status": "success", "code": 0, "data": {"UserCount": 140, "UserCountActive": 23}}),
status=200,
mimetype='application/json'
)
app.logger.info('Metrics request successfull')
return response
@app.route("/")
def hello():
app.logger.info('Main request successfull')
return "Hello World!"
if __name__ == "__main__":
logging.basicConfig(filename='app.log', level=logging.DEBUG)
app.run(host='0.0.0.0')