-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(examples): introducing examples
Signed-off-by: Daniel Boll <[email protected]>
- Loading branch information
1 parent
99716ef
commit 08e4764
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"target": "ESNext", | ||
"moduleResolution": "NodeNext" | ||
} | ||
} |