Trivial API server

ticket-769
Vadim vtroshchinskiy 2024-09-12 12:41:57 +02:00
parent 35edfa3f63
commit df01455aab
1 changed files with 31 additions and 0 deletions

31
api/gitapi.py 100644
View File

@ -0,0 +1,31 @@
from flask import Flask, jsonify
# Create an instance of the Flask class
app = Flask(__name__)
# Define a route for the root URL
@app.route('/')
def home():
return jsonify({
"message": "Welcome to my simple web service!"
})
# Define another route for /hello/<name>
@app.route('/hello/<name>')
def hello_name(name):
return jsonify({
"message": f"Hello, {name}!"
})
# Define a route for health check
@app.route('/health')
def health_check():
return jsonify({
"status": "OK"
})
# Run the Flask app
if __name__ == '__main__':
app.run(debug=True)