m2s2-cli 0.2.13

CLI for scaffolding M²S² design system projects
import os
from flask import Flask, request, make_response
from routes.health import health_bp
from routes.info import info_bp

app = Flask(__name__)

allowed_origin = os.environ.get("ALLOWED_ORIGIN", "http://localhost:4200")


@app.after_request
def apply_cors(response):
    response.headers["Access-Control-Allow-Origin"] = allowed_origin
    response.headers["Access-Control-Allow-Methods"] = "GET, POST, PUT, DELETE, OPTIONS"
    response.headers["Access-Control-Allow-Headers"] = "Content-Type, Authorization"
    return response


@app.route("/<path:path>", methods=["OPTIONS"])
@app.route("/", methods=["OPTIONS"])
def options_handler(*args, **kwargs):
    return make_response("", 204)


app.register_blueprint(health_bp)
app.register_blueprint(info_bp, url_prefix="/api/v1")

if __name__ == "__main__":
    port = int(os.environ.get("PORT", 8080))
    app.run(port=port, debug=True)