Computer scienceBackendFlaskApplication Architecture

Designing REST API

Adding responses

Report a typo

In the code below, you have a GET endpoint for getting a book by the id, all needed imports and application instance are handled behind the scenes.
Your task is to fill out blank lines on the returning statements to complete REST API logic

Write a program in Python 3
@app.route("/books/<book_id>", methods=["PUT"])
def get_book(book_id: int, ):
book_data = internal_database_request(book_id)
if not book_data:
# Fill out missing part
return ...

# Fill out missing part
return ...
___

Create a free account to access the full topic