input: Write a function that creates a Flask API to fetch data from an SQL database and return it as a JSON representation. The function should use the dict_factory function to convert each row from the database into a dictionary format, and then use the jsonify method to return the data as JSON.
  assert index().json == [{'id': 1, 'name': 'Alice', 'age': 25}, {'id': 2, 'name': 'Bob', 'age': 30}, {'id': 3, 'name': 'Charlie', 'age': 35}]
  assert index().content_type == 'application/json'
  assert index().status_code == 200
output: def index():
      conn = sqlite3.connect('example.db')
      conn.row_factory = dict_factory
      cursor = conn.cursor()
      cursor.execute("SELECT * FROM users")
      data = cursor.fetchall()
      conn.close()
      return jsonify(data)