input: Write a function to create a Flask API that fetches data from an SQL database and presents the data in the form of a JSON. The function should connect to the database, retrieve all users from a table named 'users', and return the data as a JSON response. If the API is invoked without any input, it should return all the users in JSON format.
  
  assert create_flask_api() == "import json;import sqlite3;from flask import Flask, request, jsonify;app = Flask(__name__);def dict_factory(cursor, row):\n    d = {}\n    for idx, col in enumerate(cursor.description):\n        d[col[0]] = row[idx]\n    return d;@app.route('/', methods=['GET'])\ndef index():\n    connection = sqlite3.connect('database.db')\n    connection.row_factory = dict_factory\n    cur = connection.cursor()\n    all_users = cur.execute('SELECT * FROM users;').fetchall()\n    return jsonify(all_users);if __name__ == '__main__':\n    app.run(debug = True)"
output: 
  import json
  import sqlite3
  from flask import Flask, request, 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)
  