23 lines
540 B
Python
23 lines
540 B
Python
|
from flask import Flask, jsonify
|
||
|
from routes.api import api_blueprint
|
||
|
|
||
|
def create_app():
|
||
|
app = Flask(__name__)
|
||
|
|
||
|
# Register blueprints
|
||
|
app.register_blueprint(api_blueprint)
|
||
|
|
||
|
# Error handlers
|
||
|
@app.errorhandler(404)
|
||
|
def not_found(error):
|
||
|
return jsonify({"error": "Not found"}), 404
|
||
|
|
||
|
@app.errorhandler(500)
|
||
|
def server_error(error):
|
||
|
return jsonify({"error": "Server error"}), 500
|
||
|
|
||
|
return app
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
app = create_app()
|
||
|
app.run(debug=True, host='0.0.0.0', port=5001)
|