oggit/api/gitapi.py

32 lines
601 B
Python

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)