added thing in the app.py
This commit is contained in:
		
							parent
							
								
									360d242a44
								
							
						
					
					
						commit
						5850e09f84
					
				
							
								
								
									
										23
									
								
								app.py
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								app.py
									
									
									
									
									
								
							| @ -1,11 +1,22 @@ | |||||||
| from flask import Flask | from flask import request, Flask | ||||||
|  | import json | ||||||
| 
 | 
 | ||||||
| app = Flask(__name__) | app = Flask(__name__) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @app.route("/") | @app.route('/plus_one') | ||||||
| def helloworld(): | def plus_one(): | ||||||
|     return "Helle from the hell" |     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}) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user