Skip to content

Instantly share code, notes, and snippets.

@twyle
Last active June 2, 2022 13:40
Show Gist options
  • Save twyle/c136fcea7c1cb1cce0fa6c31d3aefa9e to your computer and use it in GitHub Desktop.
Save twyle/c136fcea7c1cb1cce0fa6c31d3aefa9e to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
"""This module contains the routes associated with the default Blueprint."""
from flask import Blueprint, jsonify
from flask_login import login_required, logout_user
default = Blueprint('default', __name__, template_folder='templates', static_folder='static')
@default.route('/')
def default_route():
"""Confirm that the application is working."""
return jsonify({'hello': 'from template api'}), 200
@default.route('/logout')
@login_required
def logout():
"""Log out a logged in user."""
logout_user()
return jsonify({'hello': 'You are logged out!'}), 200
@default.route('/dashboard')
def dashboard():
"""Display the user data."""
return jsonify({'hello': 'You are at the dashboard!'}), 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment