Running the Server
The dirsql CLI is an HTTP server that exposes identical SDK functionality over POST /query and GET /events.
Subcommands
| Command | Purpose |
|---|---|
dirsql (no subcommand) | Start the long-lived HTTP server (default behavior, see below). |
dirsql init | Generate a starter .dirsql.toml from the contents of a directory. See Generating a Config. |
Running the server
Run dirsql from the directory containing your files:
bash
dirsql
$ Running at localhost:7117The server reads tables from a config file. By default it looks for ./.dirsql.toml; pass --config <path> to point at a different .toml file or a native-language config (.py / .js).
Defaults
If no config file is found, dirsql serves a single table named files, with one row per file under the directory
bash
cd ~/some/directory # no .dirsql.toml here
dirsql
$ Running at localhost:7117bash
curl -s localhost:7117/query -H 'content-type: application/json' \
-d '{"sql":"SELECT _basename, _size FROM files ORDER BY _size DESC LIMIT 5"}'A config file will override the default.
Flags
| Flag | Default | Description |
|---|---|---|
--config <path> | ./.dirsql.toml | Path to the config file (.toml or native-language). The index is rooted at the directory containing this file. |
--host <addr> | localhost | Bind address |
--port <n> | 7117 | TCP port to bind |
Once the server is running, see the HTTP API for the request and response formats.