Skip to content

Instantly share code, notes, and snippets.

@predic8
Last active August 24, 2018 09:19
Show Gist options
  • Save predic8/6eced8f6e4c94c3661cdf6acd2f00a4a to your computer and use it in GitHub Desktop.
Save predic8/6eced8f6e4c94c3661cdf6acd2f00a4a to your computer and use it in GitHub Desktop.
Python REST API Boilderplate with falcon
# pip3 install falcon
# pip3 install gunicorn
# gunicorn books:app
#
# Windows:
#
# $ pip install waitress
# $ waitress-serve --port=8000 things:app
import falcon
class BooksResource(object):
books = {
'1': { 'id': 1, 'name': 'Qualityland'},
'2': { 'id': 2, 'name': 'Anhalter'},
'3': { 'id': 3, 'name': 'Harry Potter'}
}
app = falcon.API()
app.add_route('/books', BooksResource())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment