Skip to content

Instantly share code, notes, and snippets.

@JaleelNazir
Forked from kgriffs/sample.py
Created December 26, 2016 05:29
Show Gist options
  • Save JaleelNazir/d9299335ddbfdf30a02f5a19ae5fc662 to your computer and use it in GitHub Desktop.
Save JaleelNazir/d9299335ddbfdf30a02f5a19ae5fc662 to your computer and use it in GitHub Desktop.
Falcon Web Framework (http://falconframework.org)
# sample.py
import falcon
import json
class QuoteResource:
def on_get(self, req, resp):
"""Handles GET requests"""
quote = {
'quote': 'I\'ve always been more interested in the future than in the past.',
'author': 'Grace Hopper'
}
resp.body = json.dumps(quote)
api = falcon.API()
api.add_route('/quote', QuoteResource())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment