Skip to content

Latest commit

 

History

History
139 lines (100 loc) · 2.51 KB

README.md

File metadata and controls

139 lines (100 loc) · 2.51 KB

Nest.js common libraries

Description

This Nest.js module comes with several modules which provide basic functionality such as loading configuration, making http requests and more. The module contains a sub module for each service, which can either be imported individually, or collectively by importing the CommonModule. See the module folder for the available sub modules that you can import.

// app.module.ts
import { Module } from '@nestjs/common';
import { CommonModule } from '@moesjarraf/nestjs-common';

@Module({
  imports: [CommonModule],
})
export class AppModule {}

Installation

$ npm install @moesjarraf/nestjs-common

Configuration

The modules by default load their configuration through .env files which are placed in the root folder. These can be suffixed with the environment. The available suffixes can be found below, and are loaded in the order as they are displayed.

'.env.development.local',
'.env.development',
'.env.staging',
'.env.production',
'.env.test',
'.env',

The default configuration for each sub module can be found below, and can be changed by modifying the env variables.

App

APP_NAME=Application
APP_SHORT_NAME=App
APP_DESCRIPTION=
NODE_ENV=development
PORT=3000
DEBUG=true # false if NODE_ENV=producition

Frontend

FRONTEND_INDEX=../frontend/dist/index.html

Cors

CORS_ORIGIN=*
CORS_CREDENTIALS=false
CORS_EXPOSED_HEADERS=

Cookie

COOKIE_SAME_SITE=
COOKIE_SECURE=

Body parser

BODY_PARSER_RAW_PATHS=

MongoDB

MONGO_DEFAULT_URL=mongodb://0.0.0.0:27017/nestjs

Http auth

HTTP_AUTH_BEARER_TOKEN=

Logger

LOGGER_LEVEL=
LOGGER_FORCE=

Rollbar

ROLLBAR_ACCESS_TOKEN=
ROLLBAR_ENVIRONMENT=
ROLLBAR_LEVEL=

Mailer

MAILER_TEST=false
MAILER_HOST=
MAILER_PORT=
MAILER_PASS=

Ssl

SSL_ENABLED=false

Example

See this repository for an example.

Contributing

Commit messages should be formatted according to semantic-release standards, see this link for more information. A tool has been added to the project to make adhering to the standards easier.

# add source files
git add .

# format commit message
npm run commit

# push
git push -u origin master