0.9.4 • Published 2 months 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
2 months ago
0.9.3
1 year ago
0.9.0
1 year ago
0.8.1
1 year ago
0.8.0
1 year ago
0.9.2
1 year ago
0.7.0
1 year ago
0.5.0
2 years ago
0.6.0
2 years ago
0.4.20
2 years ago
0.4.19
2 years ago
0.4.11
2 years ago
0.3.0
2 years ago
0.3.6
2 years ago
0.3.5
2 years ago
0.4.0
2 years ago
0.3.1
2 years ago
0.3.4
2 years ago
0.3.3
2 years ago
0.2.31
3 years ago
0.2.30
3 years ago
0.2.20
3 years ago
0.2.16
3 years ago
0.2.15
3 years ago
0.2.14
3 years ago
0.2.13
3 years ago
0.2.5
3 years ago
0.2.3
3 years ago
0.2.4
3 years ago
0.2.0
3 years ago
0.1.0
3 years ago
0.1.1
3 years ago
0.0.12
3 years ago
0.0.10
3 years ago
0.0.9
3 years ago
0.0.8
3 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.0.3
3 years ago
0.0.2
3 years ago