-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
30 lines (22 loc) · 718 Bytes
/
app.py
File metadata and controls
30 lines (22 loc) · 718 Bytes
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
from flask_openapi3 import OpenAPI, Info, Tag
from flask_cors import CORS
from flask import redirect
from database.database import Base, engine
from routes.projeto_routes import bp_projetos
info = Info(title="API de Projetos", version="1.0.0")
app = OpenAPI(__name__, info=info)
CORS(app=app)
# Criar BD
Base.metadata.create_all(engine)
# Registrar rotas
app.register_api(bp_projetos)
redirect_tag = Tag(name="Redirecionamento", description="Redirecionamento para docs do OpenAPI")
# Redirecionar para docs
@app.get("/", tags=[redirect_tag])
def home():
"""
Rota para redirecionamento
"""
return redirect("/openapi")
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000, debug=True)