input: Write a function to create a basic REST API using Python and Flask to list all the countries in the world. The function should include a Flask route that reads a JSON file containing the list of countries and returns it as a JSON response. If the file is not found, it should return an empty list.
  
  
  import flask
  from flask import Flask, request, jsonify
  import json
  
  app = Flask(__name__)
  
  @app.route('/countries', methods=['GET'])
  def get_countries():
      try:
          with open('data.json', 'r') as f:
              countries = json.load(f)
      except FileNotFoundError:
          countries = []
      return jsonify(countries)
  
  if __name__ == '__main__':
      app.run()
  
  
  assert get_countries() == jsonify([{"name": "Afghanistan", "code": "AF"}, {"name": "Albania", "code": "AL"}, {"name": "Algeria", "code": "DZ"}])
  assert get_countries() == jsonify([])
output: 
  def get_countries():
      try:
          with open('data.json', 'r') as f:
              countries = json.load(f)
      except FileNotFoundError:
          countries = []
      return jsonify(countries)
  