Rest API - HTTP Status Codes
You are implementing a Flask REST API endpoint to fetch a movie by its ID. If the movie does not exist, you want to return a 404 status with a JSON error message. Which of the following code snippets correctly achieves this?
from flask import Flask, jsonify, abort
app = Flask(__name__)
@app.route('/movies/')
def get_movie(id):
movies = {1: 'Inception', 2: 'Interstellar'}
# Which code correctly returns 404 with JSON if movie missing?
