input: Write a function that creates a Flask API to fetch data from an SQL database and return the data as a JSON response. The function should include a dictionary factory for converting rows into dictionaries and a route that executes a query to fetch all users from the 'users' table. If the API runs successfully, it should return the fetched data in JSON format.
  
  def create_database_api():
      import json 
      import sqlite3
      from flask import Flask, jsonify 
  
      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('/', methods=['GET'])
      def index(): 
          connection = sqlite3.connect('database.db')
          connection.row_factory = dict_factory
          cur = connection.cursor() 
          all_users = cur.execute('SELECT * FROM users;').fetchall() 
          return jsonify(all_users) 
    
      if __name__ == '__main__': 
          app.run(debug = True)
  
  assert create_database_api() is not None
output: 
  def create_database_api():
      import json 
      import sqlite3
      from flask import Flask, jsonify 
  
      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('/', methods=['GET'])
      def index(): 
          connection = sqlite3.connect('database.db')
          connection.row_factory = dict_factory
          cur = connection.cursor() 
          all_users = cur.execute('SELECT * FROM users;').fetchall() 
          return jsonify(all_users) 
    
      if __name__ == '__main__': 
          app.run(debug = True)
  