Skip to content

Instantly share code, notes, and snippets.

@ivancorrales
Last active Apr 24, 2016
Embed
What would you like to do?
Basic falcon rest api
# app.py
__author__ = "Iván Corrales Solera <developer@wesovi.com>"
__written_date = "23/04/2016"
import falcon
class BookResource(object):
def on_get(self,req,resp):
resp.status= falcon.HTTP_200
resp.body = '[' \
'{"title":"Don Quijote de la Mancha", "author":"Miguel de Cervantes"},' \
'{"title":"Romeo y Julieta", "author":"Sackespeare"}' \
']'
wsgi_app = api = falcon.API()
bookResource = BookResource()
api.add_route('/books', bookResource)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment