Connect to TallyDB servers in Node.js using TallyDB.js client driver.
- Install TallyDB.js using
npm install tallydb.js
- Connect to TallyDB server
const tallydb = require("../dist/index.js");
const connection = tallydb.connect({
host: "127.0.0.1",
port: 4053,
username: "username",
password: "password"
});
- Query the TallyDB server
const query = {
function: "QUERY",
slice: {
name: "slice1",
},
range: {
from: new Date().setMonth(0),
to: new Date(),
},
}
connection.query(
query,
(response) => {
console.log("Response", response);
},
(err) => {
console.error(err);
},
);