input: Write a function to create a Flask-based API that fetches data from an SQL database and presents the data in JSON format. The function should have no input parameters and should return the Flask application.
  assert create_app().testing == True
  assert create_app().index()!=None
  assert create_app().dict_factory!=None
output: 
  def create_app():
      from flask import Flask, jsonify
      import sqlite3
  
      app = Flask(__name__)
  
      def dict_factory(cursor, row):
          d = {}
          for idx, col in enumerate(cursor.description):
              d[col[0]] = row[idx]
          return d
  
      @app.route('/')
      def index():
          conn = sqlite3.connect('example.db')
          conn.row_factory = dict_factory
          cur = conn.cursor()
          cur.execute("SELECT * FROM data")
          rows = cur.fetchall()
          conn.close()
          return jsonify(rows)
  
      app.testing = True
      return app
  