input: Write a function to create a Python API using Flask that connects to an SQL database and returns all the data from the 'users' table in JSON format. The function should use a helper function `dict_factory` to format each row as a dictionary.
  
  The function signature should be:
  
  def create_user_api():
      # Your implementation here
      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) 
      return app
  
  
  assert create_user_api()._get_error_handlers()=={} 
  assert create_user_api().config['DEBUG']==True 
  assert create_user_api().config['JSONIFY_PRETTYPRINT_REGULAR']==True 
  assert create_user_api()._get_error_handler(500) is None 
  assert create_user_api()._get_error_handler(404) is None
  
  Write a function to create a Python API using Flask that connects to an SQL database and returns all the data from the 'users' table in JSON format. The function should use a helper function `dict_factory` to format each row as a dictionary.
  
  The function signature should be:
  
  def create_user_api():
      # Your implementation here
      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) 
      return app
  
  
  assert create_user_api()._get_error_handlers()=={} 
  assert create_user_api().config['DEBUG']==True 
  assert create_user_api().config['JSONIFY_PRETTYPRINT_REGULAR']==True 
  assert create_user_api()._get_error_handler(500) is None 
  assert create_user_api()._get_error_handler(404) is None
output: 
  def create_user_api():
      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) 
      return app
  