starbase-http-knex
v1.2.0
Published
An npm package that queries Starbase databases through HTTP endpoints using Knex
Readme
starbase-http-knex
An npm package that queries Starbase databases through HTTP endpoints using Knex.
Installation
npm install starbase-http-knex
# or
bun add starbase-http-knexUsage
import { createConnection } from "starbase-http-knex";
// The connection function returns a Knex instance
const connection = createConnection({
accountSubdomain: "your-identifier",
workerSubdomain: "starbasedb", // optional, defaults to "starbasedb"
authToken: "your-token",
});
// Basic query
const query = await connection("table_name").select("*");
// Transaction example
await connection.transaction(async (trx) => {
await trx("users").insert({ user_id: 1 });
const user = await trx("users").where({ user_id: 1 }).first();
});Changelog
See CHANGELOG.md.
