input: Write a function to create a basic REST API using Python and Flask that lists all the countries in the world. The function should define a Flask application with a route '/countries' that returns a JSON response containing the list of all countries. This list should be read from a JSON file named 'data.json'.
  
  
  import flask
  from flask import Flask, request, jsonify
  import json
  
  def create_countries_api():
      app = Flask(__name__)
  
      @app.route('/countries', methods=['GET'])
      def get_countries():
          with open('data.json', 'r') as f:
              countries = json.load(f)
          return jsonify(countries)
  
      if __name__ == '__main__':
          app.run()
  
      return app
  
  assert create_countries_api().name == '__main__'
  
output: 
  def create_countries_api():
      app = Flask(__name__)
  
      @app.route('/countries', methods=['GET'])
      def get_countries():
          with open('data.json', 'r') as f:
              countries = json.load(f)
          return jsonify(countries)
  
      if __name__ == '__main__':
          app.run()
  
      return app
  