-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.py
29 lines (24 loc) · 871 Bytes
/
routes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import app_flask as app_flask
from flask import Blueprint, Flask, request, jsonify
import requests
import managers.jwt_manager as jwt_manager
from flask_jwt_extended import jwt_required
import managers.users as users_manager
app_blueprint = Blueprint('routes', __name__)
@app_blueprint.route("/itWorks", methods=['GET'])
def defaultRoute():
return "Yes, it works!"
@app_blueprint.route("/createToken", methods=['GET'])
def createToken():
return jsonify(access_token = jwt_manager.createToken()), 201
# TODO
# Corrigir resposta desta rota, retornar sempre o status code neste modulo
@app_blueprint.route("/auth", methods=['GET'])
@jwt_required
def auth():
return jwt_manager.auth()
@app_blueprint.route("/createUser", methods=['POST'])
def createUser():
text, status_code = users_manager.createUser(request.json)
return text, status_code