input: 
  from flask import Flask, jsonify
  import sqlite3
  
  def fetch_db_data(db_path: str, table_name: str) -> dict:
      """ Fetches data from an SQL database and returns the data as a JSON object.
      >>> fetch_db_data('test_database.db', 'test_table')
      [{'id': 1, 'name': 'John'}, {'id': 2, 'name': 'Jane'}]
      """
      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(db_path)
          connection.row_factory = dict_factory
          cur = connection.cursor() 
          data = cur.execute(f'SELECT * FROM {table_name};').fetchall() 
          return jsonify(data)
      
      app.run(debug=True)
      return index()
  
output:     with app.test_request_context():
          response = index()
          return response.get_json()