This repository has been archived on 2025-03-21. You can view files and clone it, but cannot push or open issues or pull requests.
insiemesalute-3p-nx/apps/ebitemp-api/src/main.ts

40 lines
1.0 KiB
TypeScript

/**
* This is not a production server yet!
* This is only a minimal backend to get started.
*/
import { NestFactory } from '@nestjs/core';
import { Logger } from '@nestjs/common';
import { Logger as PinoLogger } from 'nestjs-pino';
import { AppModule } from './app/app.module';
import { LocalConfig, localConfig } from './app/config/local.config';
import { patchTypeOrm } from './app/modules/database/typeorm-patch';
async function bootstrap() {
await patchTypeOrm();
const appOpts = (() => {
const loggerOpts = { bufferLogs: true };
return {
forceCloseConnections: true,
...loggerOpts,
};
})();
const app = await NestFactory.create(AppModule, appOpts);
const globalPrefix = 'api';
app.setGlobalPrefix(globalPrefix);
const config = app.get<LocalConfig>(localConfig.KEY);
const port = config.port || 3000;
app.useLogger(app.get(PinoLogger));
await app.listen(port);
Logger.log(
`🚀 Application is running on: http://localhost:${port}/${globalPrefix}`
);
}
void bootstrap();