@shubuzuo/nestjs-sms

0.0.6 • Public • Published

nest-sms SMS 封装

注意:仍在开发中,目前仅在内部使用
Nest框架 短信服务 插件

使用说明

外部人员仅供参考,请不要用于生产环境,因此导致的事故后果请自行承担。

安装

$ npm i @shubuzuo/nestjs-sms

or

$ yarn add @shubuzuo/nestjs-sms 

用法

config.js 配置

export const config = {
	"ApiKeyPublic": "-------",
  "ApiKeyPrivate": "-------"
};

module.ts

import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AwsSmsModule } from '@shubuzuo/nestjs-sms'

@Module({
  imports: [
    AwsSmsModule.forRoot({
      accessKeyId: '------',
      secretAccessKey: '------',
      apiVersion: '------',
      region: '-----',
    })
  ],
  controllers: [AppController],
  providers: [],
})
export class AppModule {}

controller.ts

import { Controller, Get } from '@nestjs/common';
import { AwsSmsService, PublishResponse } from '@shubuzuo/nestjs-sms';

@Controller()
export class AppController {
  constructor(
    private readonly awsSmsService: AwsSmsService
  ) {}

  @Get('sms')
  async setSms(): Promise<PublishResponse> {
    return  await this.awsSmsService.send('17630802711', '短信内容')
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @shubuzuo/nestjs-sms

Weekly Downloads

1

Version

0.0.6

License

MIT

Unpacked Size

9.64 kB

Total Files

10

Last publish

Collaborators

  • shubuzuo