0.9.4 • Published 1 year ago
@rhangai/nest-core v0.9.4
@rhangai/nest-core
Usage
Somewhere in your main file
import '@rhangai/common/setup';
Create a config.ts
file
import { configRegister, ConfigType } from '@rhangai/nest-core';
export type Config = ConfigType<typeof configFactory>;
export const configFactory = configRegister(({ env }) => ({
env: env('APP_ENV', 'development'),
db: {
host: env('APP_DB_HOST', 'db'),
},
}));
Create the ormconfig.ts
for typeorm
import { resolve } from 'path';
import { configResolve } from '@rhangai/nest-core';
import { ConnectionOptions } from 'typeorm';
export = configResolve<ConnectionOptions>(({ env, envInt }) => ({
type: 'postgres',
host: env('APP_DB_HOST', 'db'),
port: envInt('APP_DB_PORT', 5234),
username: env('APP_DB_USERNAME', 'dev'),
password: env('APP_DB_PASSWORD', 'dev'),
database: env('APP_DB_DATABASE', 'database'),
entities: [resolve(__dirname, '../**/*.entity.{ts,js}')],
migrations: [resolve(__dirname, './migrations')],
}));
Create the root module
import { createCoreModule } from '@rhangai/nest-core';
import { configFactory } from './config';
import ormconfig from './ormconfig';
export const CoreModule = createCoreModule({
configFactory,
ormconfig,
});
Controllers
Create your controllers
import { createCoreModule } from '@rhangai/nest-core';
import { configFactory } from './config';
import ormconfig from './ormconfig';
export const CoreModule = createCoreModule({
configFactory,
ormconfig,
});
0.9.4
1 year ago
0.9.3
2 years ago
0.9.0
2 years ago
0.8.1
2 years ago
0.8.0
2 years ago
0.9.2
2 years ago
0.7.0
3 years ago
0.5.0
3 years ago
0.6.0
3 years ago
0.4.20
3 years ago
0.4.19
3 years ago
0.4.11
4 years ago
0.3.0
4 years ago
0.3.6
4 years ago
0.3.5
4 years ago
0.4.0
4 years ago
0.3.1
4 years ago
0.3.4
4 years ago
0.3.3
4 years ago
0.2.31
4 years ago
0.2.30
4 years ago
0.2.20
4 years ago
0.2.16
4 years ago
0.2.15
4 years ago
0.2.14
4 years ago
0.2.13
4 years ago
0.2.5
4 years ago
0.2.3
4 years ago
0.2.4
4 years ago
0.2.0
4 years ago
0.1.0
4 years ago
0.1.1
4 years ago
0.0.12
4 years ago
0.0.10
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago