@iot9x.com/nestjs-tdengine-restful
Version:
NestJS TDengine 驱动——基于Restful
78 lines (60 loc) • 1.92 kB
Markdown
# NestJS `TDengine` 驱动插件
注意:<font color="#dd0000">仍在开发中,目前仅在内部使用</font><br />
## 使用说明
外部人员仅供参考,请不要用于生产环境,因此导致的事故后果请自行承担。
### 支持环境
* node >=`14.x`
* NestJS === `8.x`
### 安装
```shell
$ npm i @iot9x.com/nestjs-tdengine-restful
or
$ yarn add @iot9x.com/nestjs-tdengine-restful # 推荐使用yarn
```
### 配置
#### 同步方式
```typescript
import { Module } from '@nestjs/common';
import { TDengineModule } from '@iot9x.com/nestjs-tdengine-restful'
@Module({
imports: [
TDengineModule.forRoot({
url: 'http://127.0.0.1:6041',
username: 'root',
password: 'taosdata',
logging: false
}),
]
})
export class AppModule { }
```
#### 异步方式
```typescript
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigType } from '@nestjs/config';
import { TDengineModule } from '@iot9x.com/nestjs-tdengine-restful'
import { TDengineConfigRegister } from './modules/config/registers/tdengine.register';
import { ConfigValidation } from './modules/config/validations/config.validation';
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
validationSchema: ConfigValidation,
validationOptions: {
allowUnknown: true,
abortEarly: true
},
load: [TDengineConfigRegister]
}),
TDengineModule.forRootAsync({
useFactory: (tdengineConfig: ConfigType<typeof TDengineConfigRegister>) => tdengineConfig,
inject: [TDengineConfigRegister.KEY]
})
]
})
export class AppModule {}
```
## 文档地址
* [私有Gitlab](https://gitlab.lantsang.cn/nestjs-plugins-star/nestjs-tdengine-restful/tree/master/docs)
* [GitHub](https://github.com/iot9x.com/nestjs-tdengine-restful/tree/master/docs)
* [Gitee](https://gitee.com/iot9x.com/nestjs-tdengine-restful/tree/master/docs)