connect.js 425 字节
Newer Older
1
const { options, connect } = require("@tdengine/rest");
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

async function test() {
  options.path = "/rest/sqlt";
  options.host = "localhost";
  let conn = connect(options);
  let cursor = conn.cursor();
  try {
    let res = await cursor.query("SELECT server_version()");
    res.toString();
  } catch (err) {
    console.log(err);
  }
}
test();

// output:
// server_version() |
// ===================
20
// 3.0.0            |