Added a working backend container
This commit is contained in:
parent
60415ad83f
commit
921544b76f
10 changed files with 143 additions and 16 deletions
|
@ -1,8 +1,34 @@
|
|||
import time
|
||||
from flask import Flask
|
||||
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
# Read environment variables
|
||||
if "DEBUG" in os.environ and os.environ["DEBUG"] == 'yes':
|
||||
debug = True
|
||||
else:
|
||||
debug = False
|
||||
if "HOST" in os.environ:
|
||||
host = os.environ["HOST"]
|
||||
else:
|
||||
host = '0.0.0.0'
|
||||
if "PORT" in os.environ:
|
||||
port = int(os.environ["PORT"])
|
||||
else:
|
||||
port = 5000
|
||||
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def home():
|
||||
return "Hello World"
|
||||
|
||||
@app.route('/time')
|
||||
def get_current_time():
|
||||
return {'time': time.time()}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=debug, host=host, port=port)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue