I have a small Flask application with little traffic using SQLAlchemy.
I have several API routes that use business logic, so at least for now I don't want to have the API on a different server or project.
I just want to move them away from the main bit of my code to make it more readable, so I am wondering whether to use a framework or simply create a Blueprint and have all the API routes there?
I found some info here on the different frameworks:
So I am no expert and don't really know which one to choose if any, or use a Blueprint ( like the one below):
from flask import Blueprint
api = Blueprint('api', __name__)
@api.route("/api/some_classes")
def get_come_classes():
cs = q.get_some_classes(g.session)
return JSONResponse(200, {
"some_classes": [c.render_embeded() for c in cs]
})