Created
November 3, 2016 01:29
-
-
Save jmarnold/d66bbcc76455b68f8d889a590783165c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# things.py | |
# Let's get this party started! | |
import falcon | |
# Falcon follows the REST architectural style, meaning (among | |
# other things) that you think in terms of resources and state | |
# transitions, which map to HTTP verbs. | |
class ThingsResource(object): | |
def on_get(self, req, resp): | |
"""Handles GET requests""" | |
resp.status = falcon.HTTP_200 # This is the default status | |
resp.body = ('\nO Hai\n\n') | |
# falcon.API instances are callable WSGI apps | |
app = falcon.API() | |
# Resources are represented by long-lived class instances | |
things = ThingsResource() | |
# things will handle all requests to the '/things' URL path | |
app.add_route('/things', things) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment