added thing in the app.py

This commit is contained in:
Djalim Simaila 2023-12-07 11:00:09 +01:00
parent 360d242a44
commit 5850e09f84

23
app.py
View File

@ -1,11 +1,22 @@
from flask import Flask
from flask import request, Flask
import json
app = Flask(__name__)
@app.route("/")
def helloworld():
return "Helle from the hell"
@app.route('/plus_one')
def plus_one():
x = int(request.args.get('x', 1))
return json.dumps({'x': x + 1})
if __name__ == "__main__":
app.run(debug=True,host="0.0.0.0",port=5000)
@app.route('/plus_two')
def plus_two():
x = int(request.args.get('x', 1))
return json.dumps({'x': x + 2})
@app.route('/square')
def square():
x = int(request.args.get('x', 1))
return json.dumps({'x': x * x})