forked from CodecoolBase/proman-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
100 lines (69 loc) · 2.04 KB
/
main.py
File metadata and controls
100 lines (69 loc) · 2.04 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
from flask import Flask, render_template, url_for, request
from util import json_response
import util
import data_handler
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def index():
"""
This is a one-pager which shows all the boards and cards
"""
return render_template('index.html')
@app.route("/get-boards")
@util.json_response
def get_boards():
"""
All the boards
"""
return data_handler.get_boards()
@app.route("/get-cards/<int:board_id>")
@util.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('/login', methods=["GET", "POST"])
@util.json_response
def login():
return util.user_login(request)
@app.route('/register', methods=["POST"])
@util.json_response
def register():
return util.user_register(request)
@app.route('/add-new-board', methods=['GET', 'POST'])
@util.json_response
def add_new_board():
return util.add_new_board(request)
@app.route('/dragdrop', methods=['POST'])
@util.json_response
def dragdrop():
return util.move_card(request)
@app.route('/delete-board', methods=['GET', 'POST'])
@util.json_response
def delete_board():
return util.delete_board(request)
@app.route('/add-card', methods=['GET', 'POST'])
@util.json_response
def add_card():
return util.add_new_card(request)
@app.route('/rename-card', methods=['GET', 'POST'])
@util.json_response
def rename_card():
return util.rename_card(request)
@app.route('/rename-board', methods=['GET', 'POST'])
@util.json_response
def rename_board():
return util.rename_board(request)
@app.route('/delete-card', methods=['GET', 'POST'])
@util.json_response
def delete_card():
return util.delete_card(request)
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()