Skip to content

Running the Server

Online: https://thekevinscott.github.io/dirsql/cli/server

The dirsql CLI is an HTTP server that exposes identical SDK functionality over POST /query and GET /events.

Subcommands

CommandPurpose
dirsql (no subcommand)Start the long-lived HTTP server (default behavior, see below).
dirsql initGenerate 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:7117

The server reads tables from a .dirsql.toml config file. By default it looks for ./.dirsql.toml; override the path with --config.

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:7117
bash
curl -s localhost:7117/query -H 'content-type: application/json' \
  -d '{"sql":"SELECT _basename, _size FROM files ORDER BY _size DESC LIMIT 5"}'

A .dirsql.toml file will override the default.

Flags

FlagDefaultDescription
--config <path>./.dirsql.tomlPath to the config file. The index is rooted at the directory containing this file.
--host <addr>localhostBind address
--port <n>7117TCP port to bind

Once the server is running, see the HTTP API for the request and response formats.

Released under the MIT License.