Skip to content

Commit

Permalink
feat(examples): introducing examples
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Boll <[email protected]>
  • Loading branch information
Daniel-Boll committed Jul 29, 2024
1 parent 99716ef commit 08e4764
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/auth.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Cluster } from "../index.js"

const nodes = process.env.CLUSTER_NODES?.split(",") ?? ["127.0.0.1:9042"];

const cluster = new Cluster({
nodes,
auth: {
username: "cassandra",
password: "cassandra"
}
});

const session = await cluster.connect();

await session.execute("CREATE KEYSPACE IF NOT EXISTS examples_ks WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1}");
await session.execute("DROP TABLE IF EXISTS examples_ks.auth");

console.log("Ok.");
8 changes: 8 additions & 0 deletions examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"target": "ESNext",
"moduleResolution": "NodeNext"
}
}

0 comments on commit 08e4764

Please sign in to comment.