mirror of
https://github.com/allankoechke/turso.git
synced 2026-12-01 01:27:37 +00:00
Reorganize serverless SDKs under a top-level serverless/ directory to support multi-language serverless drivers alongside the existing bindings/ convention.
21 lines
566 B
JavaScript
21 lines
566 B
JavaScript
import { createClient } from "@tursodatabase/serverless/compat";
|
|
|
|
const client = createClient({
|
|
url: process.env.TURSO_DATABASE_URL,
|
|
authToken: process.env.TURSO_AUTH_TOKEN,
|
|
});
|
|
|
|
await client.batch(
|
|
[
|
|
"CREATE TABLE IF NOT EXISTS users (email TEXT)",
|
|
"INSERT INTO users VALUES ('first@example.com')",
|
|
"INSERT INTO users VALUES ('second@example.com')",
|
|
"INSERT INTO users VALUES ('third@example.com')",
|
|
],
|
|
"write",
|
|
);
|
|
|
|
const result = await client.execute("SELECT * FROM users");
|
|
|
|
console.log("Users:", result.rows);
|