@alphaapps/nestjs-db

This module was first created to support `sequelize` ORM because it wasn't supported yet by `NestJS` but now we use `@nestjs/sequelize` package. Right now the only usage of it is to configure `sequelize` in a standard way. ### Installation: ```shell npm

Usage no npm install needed!

<script type="module">
  import alphaappsNestjsDb from 'https://cdn.skypack.dev/@alphaapps/nestjs-db';
</script>

README

Database Lib:

This module was first created to support sequelize ORM because it wasn't supported yet by NestJS but now we use @nestjs/sequelize package.
Right now the only usage of it is to configure sequelize in a standard way.

Installation:

npm install @alphaapps/nestjs-db
import { databaseConfig } from '@alphaapps/nestjs-db';
@Module({
  imports: [SequelizeModule.forRoot(databaseConfig)]
})
export default class AppModule {}

This config by default uses the following env vars:

  • DB_URL: The whole database connection url and this has the highest priority. postgres://user:password@localhost/db
  • DB_HOST: The hostname where the database is hosted
  • DB_PORT: The port of the database
  • DB_USERNAME: The username of the database
  • DB_PASS: The password of the database
  • DB_DATABASE: The name of the database For each one of the previous vars if it wasn't supplied then we take the value from config. Also by default the logging is using the debug lib with ${packageName}:database prefix.