-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
32 lines (25 loc) · 766 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Import necessary modules
from flask import Flask, jsonify
from flask_cors import CORS
# Create a Flask app
app = Flask(__name__)
CORS(app)
# Define two API endpoints
@app.route('/', methods=['GET'])
def hi():
return jsonify(message="Use /hello or /goodbye")
@app.route('/hello', methods=['GET'])
def hello():
return jsonify(message="Hello, World!")
@app.route('/goodbye', methods=['GET'])
def goodbye():
return jsonify(message="Goodbye, World!")
@app.route('/test1', methods=['GET'])
def test1():
return jsonify(message="Test1 is OK")
@app.route('/test2', methods=['GET'])
def test2():
return jsonify(message="Test2 is OK")
# Run the app if executed directly
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)