123456789101112131415161718192021222324252627282930313233343536373839 |
- """
- Main entry-point for the TerrAssumptions API server
- Running this file directly will launch a development server.
- The WSGI-compatible Flask server is exposed from this module as app.
- """
- import os
- from flask import Flask, jsonify
- from flask_cors import CORS
- from db import db
- from game_api import game
- from extra_api import extra
- app = Flask(__name__)
- CORS(app)
- app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get("DATABASE_URI", "sqlite:////tmp/terrassumptions.db")
- app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
- app.register_blueprint(game, url_prefix="/game")
- app.register_blueprint(extra, url_prefix="/")
- db.init_app(app)
- db.create_all(app=app)
- @app.route("/")
- def version():
- """
- Return the version of the API and a status message, "healthy"
- """
- return jsonify({"version": "5", "status": "healthy"})
- if __name__ == "__main__":
- app.run("0.0.0.0", 5000, debug=True)
|