Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pomdtr/sqlite-explorer
https://github.com/pomdtr/sqlite-explorer
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pomdtr/sqlite-explorer
- Owner: pomdtr
- Created: 2024-06-22T11:44:14.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-12T14:13:51.000Z (6 months ago)
- Last Synced: 2024-07-12T16:19:24.966Z (6 months ago)
- Language: TypeScript
- Size: 1.52 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SQLite Explorer
SQLite Exporer allows you to serve a SQLite database over HTTP.
It includes:
- A web interface to browse the database
- A REST API to query the database
- A CLI to serve local databases
- A client library to interact with the REST API## Initialization
Create a `mod.ts` file:
```ts
import { serveDatabase } from "jsr:@pomdtr/[email protected]/server";
import { basicAuth } from "https://esm.town/v/pomdtr/basicAuth?v=66";export default {
fetch: basicAuth(
(req: Request) => serveDatabase(req, { dbPath: "./chinook.db" }),
{
verifyUser: (_user, password) => {
return password == Deno.env.get("PASSWORD");
},
},
),
};
```Then run: `deno run -A mod.ts`
Or use the cli:
```sh
deno run @pomdtr/sqlite-explorer chinook.db
```## Web Interface
Sqlite Explorer embeds [LibSQL Studio](https://libsqlstudio.com/), a web interface to browse SQLite databases.
![Web Interface](./assets/screenshot.jpg)
## Client Library
```ts
import { createClient } from "jsr:@pomdtr/sqlite-explorer/client";const client = createClient({
url: "https://chinook.pomdtr.me",
});export default async function() {
const res = await client.execute("SELECT name FROM artists");
return Response.json(rows);
}
```