提交 7325389e 编写于 作者: 鞋子不会飞's avatar 鞋子不会飞

新增restful视图

上级 be115c44
......@@ -8,6 +8,8 @@ from utils.output import output_json
# 1.创建蓝图对象
# 细节1: 可以使用url_prefix对蓝图注册的所有路由添加统一的资源段前缀
from wyh_web_tools.resources.user import user_restful_view
user_bp = Blueprint('user_b', __name__, static_folder='static', url_prefix='/user')
......@@ -43,3 +45,6 @@ user_api.representation('application/json')(output_json)
#
# user_api.add_resource(following.FollowingListResource, '/v1_0/user/followings',
# endpoint='Followings')
user_api.add_resource(user_restful_view.Login, '/user_restful_view_login',
endpoint='user_restful_view_login')
from utils.decorators import set_db_to_write, login_required
from flask import current_app, g
from flask_restful import Resource
class Login(Resource):
"""用户登录"""
# method_decorators = [login_required]
def get(self):
print("-----------", g.user_id)
user_dict = {"name": "wyh"}
# json返回
return user_dict
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册