-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: removed datasource initialization
- Loading branch information
1 parent
07518c8
commit 54fd711
Showing
1 changed file
with
8 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,20 @@ | ||
import { NestFactory } from '@nestjs/core'; | ||
import { ConfigService } from '@nestjs/config'; | ||
import { Logger } from '@nestjs/common'; | ||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; | ||
|
||
import { AppModule } from './app.module'; | ||
import { initializeDataSource } from './database/data-source'; | ||
import { swaggerInitializer } from './config/config.swagger'; | ||
|
||
async function bootstrap() { | ||
await initializeDataSource(); | ||
const app = await NestFactory.create(AppModule); | ||
const configService = new ConfigService(); | ||
|
||
const port = configService.get('APP_PORT'); | ||
const logger = new Logger(); | ||
const app = await NestFactory.create(AppModule); | ||
|
||
/** | ||
* Swagger configuration | ||
*/ | ||
const config = new DocumentBuilder() | ||
.setTitle('Brints Estate API') | ||
.setDescription( | ||
'The modern day Real Estate API simplifying the way we buy and sell properties', | ||
) | ||
.addServer('http://localhost:3001', 'Development Server') | ||
.addServer('https://brints-estate-api.herokuapp.com', 'Production Server') | ||
.setTermsOfService('http://localhost:3001/terms') | ||
.setLicense( | ||
'MIT', | ||
'https://github.com/Brints/nestjs-brints-group-estate/blob/main/LICENSE', | ||
) | ||
.setVersion('1.0') | ||
.build(); | ||
const document = SwaggerModule.createDocument(app, config); | ||
SwaggerModule.setup('api-docs', app, document); | ||
swaggerInitializer(app); | ||
|
||
await app.listen(3001); | ||
logger.log('Application started on http://localhost:3001'); | ||
await app.listen(port); | ||
logger.log(`Application is running on ${await app.getUrl()}`); | ||
} | ||
bootstrap(); |