0.0.6 • Published 2 years ago

@gm50x/nestjs-configurator v0.0.6

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
2 years ago

Description

nestjs-configurator is a unified way to add CORS, Compression, Helmet, Serialization and initialize Swagger on NestJS applications.

Installation

$ npm install @gm50x/nestjs-configurator

Getting Started

Enabling Swagger and Cloud Events Serialization

// @main.ts
import { NestFactory } from '@nestjs/core';
import { Configurator } from '@gm50x/nestjs-configurator';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  new Configurator(app).setDefaults({
    swagger: {
      title: 'MagiTEK',
      description: 'MagiTEK Swagger Description',
    },
    enableCloudEvents: true,
  });

  await app.listen(3000);
}
bootstrap();

Or you could use without cloud events or swagger. (CORS, Compression, Helmet and Serialization(transformation))

// @main.ts
import { NestFactory } from '@nestjs/core';
import { Configurator } from '@gm50x/nestjs-configurator';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  new Configurator(app).setDefaults();
  await app.listen(3000);
}
bootstrap();