feat: changed the project structure and added new routes

This commit is contained in:
iritmaximus
2023-02-06 11:16:34 +02:00
parent 93091d08a5
commit 0d4e45bcdc
4 changed files with 46 additions and 6 deletions
+6
View File
@@ -0,0 +1,6 @@
<title>Main page</title>
<h1>Home</h1>
<p><a href="/games">Go to games</a></p>
<p><a href="/courses">Go to courses</a></p>
<p><a href="/times">Go to times</a></p>
+9
View File
@@ -0,0 +1,9 @@
<title>Login</title>
<h1>Login page</h1>
<form action="/login" method="POST">
<input type="text" name="name">
<input type="submit" name="login">
</form>
<p><a href="/">Return to homepage</a></p>
+2
View File
@@ -0,0 +1,2 @@
def generate_token_with_username():
pass
+29 -6
View File
@@ -1,22 +1,45 @@
from flask import render_template, request
from flaskr import app
from flaskr.database import db, test_db, create_db
@app.route("/")
def test_backend():
return "This is the working backend"
return render_template("home.html")
@app.route("/db")
def test_db_route():
return test_db()
# TODO show 3 games with most times submitted
@app.route("/games")
def get_games():
return "List of games"
@app.route("/login")
# TODO show 3 courses with most activity
@app.route("/courses")
def get_courses():
return "List of courses"
# TODO show 3 newest times submitted
@app.route("/times")
def get_times():
return "List of times"
@app.route("/login", methods=["GET", "POST"])
def login():
return "Login to the site"
if request.method == "GET":
return render_template("login.html")
else:
return "Todo POST request"
@app.route("/init")
def initialize_db():
return create_db()
@app.route("/db")
def test_db_route():
return test_db()