From 36bdcd5e6fdc2991cfb631338ea5d8acee798a68 Mon Sep 17 00:00:00 2001 From: James Wang Date: Wed, 23 Dec 2015 19:54:47 -0500 Subject: [PATCH] Add user blueprint to app.py --- server/api/api.py | 8 -------- server/api/user.py | 15 +++++++++++++-- server/app.py | 2 ++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/server/api/api.py b/server/api/api.py index 7626508..c55788b 100644 --- a/server/api/api.py +++ b/server/api/api.py @@ -1,11 +1,3 @@ from flask import Blueprint api = Blueprint("api", __name__) - -@api.route("/api/register", methods=["POST"]) -def register(): - pass - -@api.route("/api/login", methods=["POST"]) -def login(): - pass diff --git a/server/api/user.py b/server/api/user.py index 315df69..2150358 100644 --- a/server/api/user.py +++ b/server/api/user.py @@ -1,4 +1,4 @@ -from flask import Blueprint +from flask import Blueprint, session from utils import api_wrapper blueprint = Blueprint("user", __name__) @@ -6,4 +6,15 @@ blueprint = Blueprint("user", __name__) @blueprint.route("/register", methods=["POST"]) @api_wrapper def user_register(): - return { "success": 0, "message": "Registration is not open yet." } \ No newline at end of file + return { "success": 0, "message": "Registration is not open yet." } + +@blueprint.route("/logout", methods=["POST"]) +@api_wrapper +def user_logout(): + # session.clear() + pass + +@blueprint.route("/login", methods=["POST"]) +@api_wrapper +def user_login(): + pass \ No newline at end of file diff --git a/server/app.py b/server/app.py index 9ee2124..cb2aa98 100644 --- a/server/app.py +++ b/server/app.py @@ -6,10 +6,12 @@ import json import api from api.api import api as api_blueprint +from api.user import blueprint as user_blueprint app = Flask(__name__) app.secret_key = config.SECRET app.register_blueprint(api_blueprint) +app.register_blueprint(user_blueprint) @app.route("/api") def api_main():