How to use the @nestjs/platform-express.MulterModule.registerAsync function in @nestjs/platform-express

To help you get started, weโ€™ve selected a few @nestjs/platform-express examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vellengs / nestx / packages / servers / nestx-cms / src / cms.module.ts View on Github external
import { ConfigModule, ConfigService } from "nestx-config";

const models = [
  { name: "Article", schema: ArticleSchema },
  { name: "Category", schema: CategorySchema },
  { name: "Comment", schema: CommentSchema },
  { name: "Media", schema: MediaSchema },
  { name: "Page", schema: PageSchema },
  { name: "Photo", schema: PhotoSchema },
  { name: "Widget", schema: WidgetSchema },
  { name: "Content", schema: ContentSchema },
  { name: "Custom", schema: CustomSchema }
];
@Module({
  imports: [
    MulterModule.registerAsync({
      imports: [ConfigModule],
      useFactory: async (configService: ConfigService) => ({
        dest: configService.get("MULTER_DEST")
      }),
      inject: [ConfigService]
    }),
    MongooseModule.forFeature(models)
  ],
  controllers: [...CmsControllers],
  providers: [...CmsServices]
})
export class CmsModule {}
github vellengs / nestx / packages / server / src / cms / cms.module.ts View on Github external
import { ConfigModule, ConfigService } from './../config';

const models = [
  { name: 'Article', schema: ArticleSchema },
  { name: 'Category', schema: CategorySchema },
  { name: 'Comment', schema: CommentSchema },
  { name: 'Media', schema: MediaSchema },
  { name: 'Page', schema: PageSchema },
  { name: 'Photo', schema: PhotoSchema },
  { name: 'Widget', schema: WidgetSchema },
  { name: 'Content', schema: ContentSchema },
  { name: 'Custom', schema: CustomSchema },
];
@Module({
  imports: [
    MulterModule.registerAsync({
      imports: [ConfigModule],
      useFactory: async (configService: ConfigService) => ({
        dest: configService.get('MULTER_DEST'),
      }),
      inject: [ConfigService],
    }),
    MongooseModule.forFeature(models),
  ],
  controllers: [...CmsControllers],
  providers: [...CmsServices],
})
export class CmsModule {}
github SolidZORO / leaa / packages / leaa-api / src / modules / attachment / attachment.module.ts View on Github external
import { Attachment } from '@leaa/common/src/entrys';
import { ConfigService } from '@leaa/api/src/modules/config/config.service';
import { AuthTokenModule } from '@leaa/api/src/modules/auth-token/auth-token.module';
import { AttachmentController } from '@leaa/api/src/modules/attachment/attachment.controller';
import { AttachmentResolver } from '@leaa/api/src/modules/attachment/attachment.resolver';
import { AttachmentService } from '@leaa/api/src/modules/attachment/attachment.service';
import { MulterService } from '@leaa/api/src/modules/attachment/multer.service';
import { SaveInOssService } from '@leaa/api/src/modules/attachment/save-in-oss.service';
import { SaveInLocalService } from '@leaa/api/src/modules/attachment/save-in-local.service';
import { AttachmentProperty } from '@leaa/api/src/modules/attachment/attachment.property';

@Module({
  imports: [
    TypeOrmModule.forFeature([Attachment]),
    MulterModule.registerAsync({
      inject: [ConfigService],
      useClass: MulterService,
    }),
    AuthTokenModule,
  ],
  controllers: [AttachmentController],
  providers: [
    AttachmentResolver,
    AttachmentService,
    AttachmentProperty,
    MulterService,
    SaveInOssService,
    SaveInLocalService,
  ],
  exports: [AttachmentService],
})
github topfullstack / topfullstack / server / apps / admin / src / app.module.ts View on Github external
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { DbModule } from '@libs/db';
import { UsersModule } from './users/users.module';
import { CoursesModule } from './courses/courses.module';
import { EpisodesModule } from './episodes/episodes.module';
import { MulterModule } from '@nestjs/platform-express';
import { CommonModule } from '@app/common';

const MAO = require('multer-aliyun-oss');


@Module({
  imports: [
    CommonModule,
    MulterModule.registerAsync({
      useFactory(){
        return {
          storage: MAO({
            config: {
              region: process.env.OSS_REGION,
              accessKeyId: process.env.OSS_ACCESS_KEY_ID,
              accessKeySecret: process.env.OSS_ACCESS_KEY_SECRET,
              bucket: process.env.OSS_BUCKET
            }
          })
        }
      }
    }),
    
    UsersModule,
    CoursesModule,

@nestjs/platform-express

Nest - modern, fast, powerful node.js web framework (@platform-express)

MIT
Latest version published 6 days ago

Package Health Score

95 / 100
Full package analysis

Similar packages