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 the Flask application with a route that reads a JSON file containing the list of countries and returns the data as a JSON response. Ensure the function properly handles loading the JSON file and setting up the Flask app.
  
  
  from flask import Flask, jsonify
  import json
  
  def create_country_list_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)
  
      return app
  
  # Example usage:
  app = create_country_list_api()
  if __name__ == '__main__':
      app.run()
  
  
  assert create_country_list_api().name == '__main__'
output: 
  def create_country_list_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)
  
      return app
  