input: Write a function to create an API in Python that fetches data from an SQL database and presents the data in the form of a JSON. The API should return all records from a table named 'users' when accessed via a GET request to the root endpoint '/'.
  assert get_users() == [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]
output: def get_users():
      import sqlite3
      import json
      conn = sqlite3.connect('database.db')
      cursor = conn.cursor()
      cursor.execute("SELECT id, name FROM users")
      rows = cursor.fetchall()
      users = [{"id": row[0], "name": row[1]} for row in rows]
      conn.close()
      return users