Last active
August 24, 2018 09:19
-
-
Save predic8/6eced8f6e4c94c3661cdf6acd2f00a4a to your computer and use it in GitHub Desktop.
Python REST API Boilderplate with falcon
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
# 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