Skip to content
Snippets Groups Projects
Commit d64040f7 authored by MESLI Mohamed's avatar MESLI Mohamed
Browse files

Truc 2

parent f168a96c
No related branches found
No related tags found
No related merge requests found
from flask import Flask from flask import Flask
import json
app=Flask(__name__) app=Flask(__name__)
@app.route("/") @app.route("/plus_one")
def hello_world(): def plus_one():
return "Hello from Flask" x= int(request.args.get('x', 1))
return json.dumps({'x': x + 1 })
if __name__ == '__main__': @app.route("/plus_two")
app.run(debug=True, host='0.0.0.0', port=5000) 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})
if __name__ == '__main__':
app.run(debug=True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment