Skip to content

Commit

Permalink
Adding flask restful example
Browse files Browse the repository at this point in the history
  • Loading branch information
theacodes committed Feb 6, 2015
1 parent d1a48d7 commit eb65f0f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
25 changes: 16 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
"""`main` is the top level module for your Flask application."""

# Import the Flask Framework
from flask import Flask
from flask.ext import restful


app = Flask(__name__)
# Note: We don't need to call run() since our application is embedded within
# the App Engine WSGI application server.
api = restful.Api(app)


class HelloWorld(restful.Resource):
def get(self):
return {'hello': 'world'}


api.add_resource(HelloWorld, '/')


@app.route('/')
def hello():
"""Return a friendly HTTP greeting."""
return 'Hello World!'
# @app.route('/')
# def hello():
# """Return a friendly HTTP greeting."""
# return 'Hello World!'


@app.errorhandler(404)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
#
# Note: The `lib` directory is added to `sys.path` by `appengine_config.py`.
Flask==0.10
flask-restful

0 comments on commit eb65f0f

Please sign in to comment.