0.5.2 • Published 2 years ago

@collection-nest/database v0.5.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@nest-collection/database

Wrapper around @nestjs/typeorm so that we can setup database easily. In the future the module can be more generic and include other ORMs as well.

This module is dependent on @collection-nest/environment.

Install

yarn add @collection-nest/database pg pg-connection-string @types/pg-connection-string typeorm

Example

const nodeEnvToPath = {
  production: '.env.production',
  development: '.env.development',
}

const NODE_ENV = process.env.NODE_ENV as keyof typeof nodeEnvToPath

// Optional
const validationSchema = Joi.object({
  NODE_ENV: Joi.string().valid('development', 'production').required(),
  PORT: Joi.number().default(3000),
})

const envFilePath = nodeEnvToPath[NODE_ENV]

DatabaseModule.register({
  environmentConfig: {
    envFilePath,
    validationSchema,
  },
})
0.5.2

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago