input: 
  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)
  
  def fetch_sql_as_json(database_path: str) -> str:
      """ This function connects to an SQL database, fetches all data from a specified table, and returns the data as a JSON string.
      The function uses Flask to create an API that can be accessed to fetch the data.
      
      >>> fetch_sql_as_json('database.db')
      '[{"id": 1, "name": "John", "age": 30}, {"id": 2, "name": "Jane", "age": 25}]'
      """
  
output:     
      connection = sqlite3.connect(database_path)
      connection.row_factory = dict_factory
      cur = connection.cursor()
      all_data = cur.execute('SELECT * FROM users;').fetchall()
      connection.close()
      return json.dumps(all_data)
  