from flask import Flask, request, jsonify
from flask_cors import CORS
from printingFunctions import *

app = Flask(__name__)
CORS(app)  # Enable CORS for all routes and origins

@app.route('/print-label', methods=['POST'])
def handle_data():
    try:
        data = request.get_json()
        printLabel(data)

        response = {
            "message": "Printed received successfully",
        }

        return jsonify(response), 200
    except Exception as e:
        return jsonify({"error": str(e)}), 500

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5003, debug=False)

