chore: add typeorm config
This commit is contained in:
+18
-4
@@ -1,8 +1,22 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
import { Logger } from "@nestjs/common";
|
||||
import { ConfigService } from "@nestjs/config";
|
||||
import { NestFactory } from "@nestjs/core";
|
||||
import { FastifyAdapter, NestFastifyApplication } from "@nestjs/platform-fastify";
|
||||
|
||||
import { AppModule } from "./app.module";
|
||||
import { getSwaggerDocument } from "./configs/swagger.config";
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
await app.listen(process.env.PORT ?? 3000);
|
||||
const logger = new Logger("APP");
|
||||
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter());
|
||||
const configService = app.get<ConfigService>(ConfigService);
|
||||
|
||||
getSwaggerDocument(app);
|
||||
|
||||
const PORT = configService.getOrThrow<number>("PORT");
|
||||
await app.listen(PORT, () => {
|
||||
logger.log(`Server running on http://localhost:${PORT}`);
|
||||
logger.log(`Swagger running on http://localhost:${PORT}/api-docs`);
|
||||
});
|
||||
}
|
||||
bootstrap();
|
||||
|
||||
Reference in New Issue
Block a user