@pluzchat/nestjs-ses
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

NestJS SES

Table of Contents

Description

Integrates SES with Nest

Installation

npm install @pluzchat/nestjs-ses aws-sdk

You can also use the interactive CLI

SesModule.forRoot(options, connection?)

import { Module } from '@nestjs/common';
import { SesModule } from '@pluzchat/nestjs-ses';
import { AppController } from './app.controller';

@Module({
  imports: [
    SesModule.forRoot({
        config: {
            credentials: {
                accessKeyId: "Key",
                secretAccessKey: "Secret",
            },
        },
    }),
  ],
  controllers: [AppController],
})
export class AppModule {}

SesModule.forRootAsync(options, connection?)

import { Module } from '@nestjs/common';
import { SesModule } from '@pluzchat/nestjs-ses';
import { AppController } from './app.controller';

@Module({
  imports: [
    SesModule.forRootAsync({
      useFactory: () => ({
          config: {
              credentials: {
                  accessKeyId: "KEY",
                  secretAccessKey: "SECRET",
              },
          },
      }),
    }),
  ],
  controllers: [AppController],
})
export class AppModule {}

InjectS3(connection?)

import { Controller, Get, } from '@nestjs/common';
import { InjectSES, SES } from '@pluzchat/nestjs-ses';

@Controller()
export class AppController {
  constructor(
    @InjectSES() private readonly sesSvc: SES,
  ) {}

  @Get()
  async getHello() {
      var params = {
          FailureRedirectionURL: 'STRING_VALUE', /* required */
          FromEmailAddress: 'STRING_VALUE', /* required */
          SuccessRedirectionURL: 'STRING_VALUE', /* required */
          TemplateContent: 'STRING_VALUE', /* required */
          TemplateName: 'STRING_VALUE', /* required */
          TemplateSubject: 'STRING_VALUE' /* required */
      };
      this.sesSvc.createCustomVerificationEmailTemplate(params, function(err, data) {
          if (err) console.log(err, err.stack); // an error occurred
          else     console.log(data);           // successful response
      });
  }
}

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @pluzchat/nestjs-ses

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

14.4 kB

Total Files

18

Last publish

Collaborators

  • tuantk