Add user blueprint to app.py

This commit is contained in:
James Wang 2015-12-23 19:54:47 -05:00
parent c6add58ee1
commit 36bdcd5e6f
3 changed files with 15 additions and 10 deletions

View file

@ -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

View file

@ -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." }
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

View file

@ -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():