From 5850e09f8420ec453e22ff36805645c1d6a04a6c Mon Sep 17 00:00:00 2001 From: Djalim Simaila Date: Thu, 7 Dec 2023 11:00:09 +0100 Subject: [PATCH] added thing in the app.py --- app.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index a6ec564..27197a5 100644 --- a/app.py +++ b/app.py @@ -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})