diff --git a/examples/PY/index.py b/examples/PY/index.py new file mode 100644 index 0000000..e69de29 diff --git a/examples/PY1/index.py b/examples/PY1/index.py new file mode 100644 index 0000000..81018d3 --- /dev/null +++ b/examples/PY1/index.py @@ -0,0 +1,43 @@ +from flask import Flask, request, jsonify # Import the Flask class from the flask module and other necessary modules +import time # Example module to simulate processing time +from flask_cors import CORS # This is the only new import # Import the Flask class from the flask module and other necessary modules + + +app = Flask(__name__) # Create a Flask app +CORS(app) # This will enable CORS for all routes + +# Define a route +@app.route('/your-endpoint') +def your_function(): + data = {"message": "Hello, world! ferom your-endpoint"} + return jsonify(data) + +@app.route('/run-script', methods=['POST']) +def run_script(): + data = request.json.get('data') + # Simulate running a Python script (replace this with your actual logic) + time.sleep(2) # Simulating a delay + result = f'Processed data: {data}' # Example response + + return jsonify({'message': result}) + + +@app.route('/') +def home(): + return 'Hello, From The Home route World!' + +@app.route('/about') +def about(): + return 'About' + +# Users/dovpeles/workspace/jojobot/py/greet.py + +# from finrl.config_tickers import DOW_30_TICKER +# print(DOW_30_TICKER) +from datetime import datetime +now = datetime.now() +formatted_time = now.strftime("%Y-%m-%d %H:%M:%S") +print(f"Hello from greet.py at {formatted_time}") + +if __name__ == '__main__': + app.run(debug=True) diff --git a/examples/PY1/requirements.txt b/examples/PY1/requirements.txt new file mode 100644 index 0000000..23a17b8 --- /dev/null +++ b/examples/PY1/requirements.txt @@ -0,0 +1,2 @@ +Flask - CORS +flask diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..0611b41 --- /dev/null +++ b/vercel.json @@ -0,0 +1,15 @@ +{ + "version": 2, + "builds": [ + { + "src": "index.py", + "use": "@vercel/python" + } + ], + "routes": [ + { + "src": "/(.*)", + "dest": "index.py" + } + ] +} \ No newline at end of file