Last active
April 24, 2016 06:23
Star
You must be signed in to star a gist
Basic falcon rest api
This file contains 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
# 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