-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathmain.py
More file actions
56 lines (39 loc) · 1.09 KB
/
main.py
File metadata and controls
56 lines (39 loc) · 1.09 KB
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
53
54
55
56
from flask import Flask, render_template, url_for, request
from util import json_response
import persistence
import data_handler
import json
app = Flask(__name__)
@app.route("/")
def index():
"""
This is a one-pager which shows all the boards and cards
"""
return render_template('index.html')
@app.route("/get-boards")
@json_response
def get_boards():
"""
All the boards
"""
return persistence.get_sql_boards()
@app.route("/get-cards/<int:board_id>")
@json_response
def get_cards_for_board(board_id: int):
"""
All cards that belongs to a board
:param board_id: id of the parent board
"""
return data_handler.get_cards_for_board(board_id)
@app.route('/add-new-board', methods=["GET", "POST"])
@json_response
def add_new_board():
title = request.get_json()['title']
return data_handler.add_new_board(title)
def main():
app.run(debug=True)
# Serving the favicon
with app.app_context():
app.add_url_rule('/favicon.ico', redirect_to=url_for('static', filename='favicon/favicon.ico'))
if __name__ == '__main__':
main()