""" 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 app = Flask(__name__) CORS(app) app.config["GOOGLE_API_KEY"] = os.environ["GOOGLE_API_KEY"] app.config["SQLALCHEMY_DATABASE_URI"] = os.environ["DATABASE_URI"] app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False app.register_blueprint(game, url_prefix="/game") 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": "1", "status": "healthy"}) @app.route("/googleApiKey") def google_api_key(): """ Return the google API key configured for the application """ return jsonify({"googleApiKey": app.config["GOOGLE_API_KEY"]}) if __name__ == "__main__": app.run("0.0.0.0", 5000, debug=True)