| 1234567891011121314151617181920212223 | 
							- #!/bin/env python
 
- from flask import Flask, request
 
- from flask_restful import Resource, Api
 
- app = Flask(__name__)
 
- api = Api(app)
 
- # This isn't available when run from gunicorn
 
- todos = {}
 
- class TodoSimple(Resource):
 
-     def get(self, todo_id):
 
-         return {todo_id: todos[todo_id]}
 
-     def put(self, todo_id):
 
-         todos[todo_id] = request.form['data']
 
-         return {todo_id: todos[todo_id]}
 
- api.add_resource(TodoSimple, '/<string:todo_id>')
 
- if __name__ == '__main__':
 
-     app.run(port=11022,debug=True)
 
 
  |