-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
40 lines (32 loc) · 1.22 KB
/
app.py
File metadata and controls
40 lines (32 loc) · 1.22 KB
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
30
31
32
33
34
35
36
37
38
39
40
from flask import Flask, jsonify
from flask_restful import Api
from resources.sintoma import Sintoma
from resources.droga import Droga
from resources.ficha_medica import FichaMedica
# from resources.hotel import Hoteis, Hotel
# from resources.usuario import User, UserRegister, UserLogin, UserLogout
# from flask_jwt_extended import JWTManager
# from blacklist import BLACKLIST
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:''@localhost/dbVisao'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['JWT_SECRET_KEY'] = 'DontTellAnyone'
app.config['JWT_BLACK_LIST_ENABLED'] = True # Ativação da BLACKLIST, permitindo invalidar algum ID
api = Api(app)
# jwt = JWTManager(app)
@app.before_first_request
def cria_banco():
banco.create_all()
# @jwt.token_in_blacklist_loader
# def verifica_blacklist(token):
# return token['jti'] in BLACKLIST
# @jwt.revoked_token_loader
# def token_acesso_invalidado():
# return jsonify({'message': 'You have been logged out'}), 401
api.add_resource(Sintoma, '/sintoma')
api.add_resource(Droga, '/droga')
api.add_resource(FichaMedica, '/fichaMedica')
if __name__ == '__main__':
from sql_alchemy import banco
banco.init_app(app)
app.run(debug=True)