Last active
June 29, 2024 18:51
-
-
Save 5t33/ce13d98637ab46fada4a7ed39d788ca7 to your computer and use it in GitHub Desktop.
flask_boilerplate.py
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
from flask import ( | |
Flask, | |
request | |
) | |
app = Flask(__name__) | |
library = {} | |
@app.route('/book', methods=['POST']) | |
def create_book(): | |
data = request.get_json() | |
library[data['title']] = data | |
return library[data['title']], 201 | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment