Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, jsonify
- app = Flask(__name__ )
- library = [
- {
- 'id': 1,
- 'title': u'Harry Potter and the Prisoner of Azkaban',
- 'author': u').K:Rowling',
- 'available': False
- },
- {
- 'id': 2,
- 'title': u'Leviathan Wakes',
- 'author': u'James S$. A. Corey',
- 'available': True
- }
- ]
- @app.route('/')
- def hello_world():
- return 'Hello to Library! '
- @app.route('/api/v1.@/books', methods=['GET'])
- def get_books():
- return jsonify({'library': library})
- if __name__ == "__main__":
- app.run(host='localhost', port=5000, debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement