1.1.1 • Published 12 months ago

@bryancm/nestjs-development-package v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

NestJS Development Package

This is a library that can be used in your projects to perform common actions across your Services and Controllers.

Instructions

Installation

$ npm install @bryancm/nestjs-development-package

Library Usage

You have to import the main module (DevelopmentPackageModule) in your Application.

Reading the Environment File

There's a Helper with the name EnvironmentHelperService that can be used to read your Environment Variables.

First at all, you have to tell the module where your Environment File (.env) is

import { Module } from '@nestjs/common';
import { DevelopmentPackageModule } from '@bryancm/nestjs-development-package';
import { join } from 'path';

@Module({
  imports: [
    DevelopmentPackageModule.forRoot({
      envFilePath: join(__dirname, '/../.env')
    })
  ],
})
export class AppModule {}

After that, you only have to use the helper anywhere:

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { EnvironmentHelperService } from '@bryancm/nestjs-development-package/helpers';
import { Logger } from '@nestjs/common';

const environmentHelper: EnvironmentHelperService = new EnvironmentHelperService();

async function bootstrap() {
  const PORT = environmentHelper.getInteger('APP_PORT');
  const logger = new Logger();
  const app = await NestFactory.create(AppModule);

  await app.listen(PORT);
  logger.debug(`App running on the PORT ${PORT} for the "${environmentHelper.getString('ENVIRONMENT')}" ENVIRONMENT`);
}
bootstrap();

List of Functionalities

In this library you can find:

  • Const Values
  • Contracts (Interfaces)
  • DTOs
  • Helpers (Date, String, Object, Array, Environment, etc)
  • Pipes
  • Services (Database Connections and API Integrations)
1.1.1

12 months ago

1.1.0

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago