diff --git a/fablib.py b/fablib.py index 021728d..1308c74 100644 --- a/fablib.py +++ b/fablib.py @@ -1,9 +1,40 @@ -from flask import Flask +# -*- coding: utf-8 -*- + +from flask import Flask, request +from flask.ext.restful import Resource, Api + app = Flask(__name__) +api = Api(app) @app.route('/') def hello(): return 'Hello World!' +todos = {} +todos['1'] = 'yo' + +class UserProfile(Resource): + def get(self, profile): + return {profile: todos[profile]} + + def put(self, profile): + todos[profile] = request.form['data'] + return {profile: todos[profile]} + +api.add_resource(UserProfile, '/') + +class Document(Resource): + def get(self, profile, document): + return {profile: todos[profile]} + + def put(self, profile, document): + todos[profile] = request.form['data'] + return {profile: todos[profile]} + +api.add_resource(Document, '//') + + + + if __name__ == '__main__': app.run() \ No newline at end of file