Here is the GitHub repository.
Quickstart
Prerequisites
Before you begin, make sure you have:
- A Fortress account
- Connection to your cloud account
- Your API token
- Your Organization ID
You can find your API token and Organization ID in the Fortress dashboard under the API Keys section.
Installation
Install the SDK using npm:
npm install fortress-backend-sdk
Get Started
import { Fortress } from "fortress-sdk";
const client = new Fortress(apiKey, organizationId);
const conn = client.conn;
client.createTenant("tenant_name", "alias");
const client = client.connectTenant("tenant_name");
const client = client.client;
conn.query("CREATE TABLE users (id SERIAL PRIMARY KEY, name VARCHAR(50))");
conn.query("INSERT INTO users (name) VALUES ('Alice')");
conn.query("SELECT * FROM users", (result) => {
result.forEach((row) => {
console.log(`User: ${row["name"]}`);
});
});
conn.deleteTenant("tenant_name");