mirror of
https://github.com/CaramelFur/Picsur.git
synced 2026-01-29 02:19:04 +01:00
24 lines
679 B
TypeScript
24 lines
679 B
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import {
|
|
FastifyAdapter,
|
|
NestFastifyApplication,
|
|
} from '@nestjs/platform-fastify';
|
|
import { DataSource } from 'typeorm';
|
|
import { TypeOrmConfigService } from './config/early/type-orm.config.service';
|
|
import { DatabaseModule } from './database/database.module';
|
|
|
|
async function createDataSource() {
|
|
// Create nest app
|
|
const app = await NestFactory.create<NestFastifyApplication>(
|
|
DatabaseModule,
|
|
new FastifyAdapter(),
|
|
);
|
|
|
|
const configFactory = app.get(TypeOrmConfigService);
|
|
const config = await configFactory.createTypeOrmOptions();
|
|
|
|
return new DataSource(config as any);
|
|
}
|
|
|
|
export default createDataSource();
|