@iot9x.com/nestjs-ucpaas-voice
v0.1.3
Published
nestjs 云之讯平台语音集成插件
Downloads
101
Readme
NestJS 云之讯语音服务集成插件
注意:仍在开发中,目前仅在内部使用
- v0.x 文档待完善
支持环境
|版本|对应nestjs版本|云之讯平台|
|-----|-----|-----|
| v0.x
| v9.x
|新版|
安装
$ npm i @iot9x.com/nestjs-ucpaas-voice
or
$ yarn add @iot9x.com/nestjs-ucpaas-voice
or
$ pnpm add @iot9x.com/nestjs-ucpaas-voice # 推荐使用pnpm
配置
同步方式
import { Module } from '@nestjs/common';
import { UcpaasModule } from '@iot9x.com/nestjs-ucpaas-voice'
@Module({
imports: [
UcpaasModule.forRoot({
clientid: '云之讯平台账户',
password: '云之讯平台密码'
})
]
})
export class AppModule { }
异步方式
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigType } from '@nestjs/config';
import { UcpaasModule } from '../src';
import { TestRegister } from './modules/config/registers/test.register';
import { UcpaasRegister } from './modules/config/registers/ucpaas.register';
import { ConfigValidation } from './modules/config/validations/config.validation';
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
validationSchema: ConfigValidation,
validationOptions: {
allowUnknown: true,
abortEarly: true
},
load: [UcpaasRegister, TestRegister]
}),
UcpaasModule.forRootAsync({
useFactory: (ucpaasConfig: ConfigType<typeof UcpaasRegister>) => ({
clientid: ucpaasConfig.clientid,
password: ucpaasConfig.password
}),
inject: [UcpaasRegister.KEY]
})
]
})
export class AppModule {}