-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
52 lines (37 loc) · 1.04 KB
/
main.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
50
51
52
from flask import Flask, render_template
import parse_calendar
import parse_menu
import helper
import json
##* WEB APP ##
app = Flask(__name__)
# app.config.from_object('config')
@app.route("/")
def home():
quote, author = helper.getQuote()
return render_template("index.html", quote=quote, author=author)
@app.route("/api/date")
def date():
return json.dumps({"date": helper.getDateReadable()})
@app.route("/api/cal")
def cal():
return parse_calendar.parse_all_calendars()
#! TESTING LINE
with open("examplecal.json") as file:
data = json.load(file)
return data
@app.route("/api/menu")
def menu():
return parse_menu.main()
#! TESTING LINE
with open("examplemenu.json") as file:
data = json.load(file)
return data
@app.route("/api/quote")
def quote():
quote, author = helper.getQuote()
return json.dumps({"quote": quote, "author": author})
# Run as flask app (locally only) for testing.
# Production level runs gunicorn (WSGI server)
if __name__ == "__main__":
app.run(debug=True)