未验证 提交 13bdd5af 编写于 作者: X xiaolei li 提交者: GitHub

docs: update node-rest examples and reference (#20011)

上级 c0674f03
......@@ -265,6 +265,14 @@ let cursor = conn.cursor();
<NodeQuery />
</TabItem>
<TabItem value="rest" label="REST connection">
```js
{{#include docs/examples/node/restexample/query_example.js}}
```
</TabItem>
</Tabs>
......
const { options, connect } = require("@tdengine/rest");
async function query() {
options.path = "/rest/sql";
options.host = "localhost";
options.port = 6041;
let conn = connect(options);
let cursor = conn.cursor();
try {
let res = await cursor.query('select * from power.meters');
console.log("res.getResult()", res.getResult());
} catch (err) {
console.log(err);
}
}
query();
......@@ -13,8 +13,6 @@ import NodeInfluxLine from "../07-develop/03-insert-data/_js_line.mdx";
import NodeOpenTSDBTelnet from "../07-develop/03-insert-data/_js_opts_telnet.mdx";
import NodeOpenTSDBJson from "../07-develop/03-insert-data/_js_opts_json.mdx";
import NodeQuery from "../07-develop/04-query-data/_js.mdx";
import RESTQuery from "../07-develop/04-query-data/_js.mdx";
import RESTSQLInsert from "../07-develop/03-insert-data/_js_sql.mdx";
`@tdengine/client` 和 `@tdengine/rest` 是 TDengine 的官方 Node.js 语言连接器。 Node.js 开发人员可以通过它开发可以存取 TDengine 集群数据的应用软件。注意:从 TDengine 3.0 开始 Node.js 原生连接器的包名由 `td2.0-connector` 改名为 `@tdengine/client` 而 rest 连接器的包名由 `td2.0-rest-connector` 改为 `@tdengine/rest`。并且不与 TDengine 2.x 兼容。
......@@ -270,6 +268,14 @@ let cursor = conn.cursor();
<NodeQuery />
</TabItem>
<TabItem value="rest" label="REST 连接">
```js
{{#include docs/examples/node/restexample/query_example.js}}
```
</TabItem>
</Tabs>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册