Created
June 2, 2022 14:04
-
-
Save twyle/1c28a1b1bd53e1cab303946953f4b6f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""This module contains the routes associated with the default Blueprint.""" | |
import re | |
from flask import Blueprint, jsonify, render_template | |
from flask_login import login_required, logout_user | |
import json | |
default = Blueprint('default', __name__, template_folder='templates', static_folder='static') | |
@default.route('/') | |
def default_route(): | |
"""Confirm that the application is working.""" | |
return render_template('home.html'), 200 | |
@default.route('/logout') | |
@login_required | |
def logout(): | |
"""Log out a loogged in user.""" | |
logout_user() | |
return jsonify({'hello': 'You are logged out!'}), 200 | |
@default.route('/dashboard/<user_data>') | |
def dashboard(user_data): | |
"""Display the user data.""" | |
user_data = json.loads(user_data) | |
return render_template('dashboard.html', user_data=user_data), 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment