Skip to content

Instantly share code, notes, and snippets.

@ivancorrales
Last active April 24, 2016 06:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ivancorrales/6d6670cd317bd6ca860262dfd4d1b81a to your computer and use it in GitHub Desktop.
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